Query layers

Query layers are SQL queries stored in maps in ArcGIS Pro projects. Query layers allow you to access spatial and nonspatial tables and views in databases and cloud data warehouses. For example, you may not have permissions in the database to create a view, but you want to limit what data from a feature class shows up in your map. You can create a query layer in the map that selects only certain fields or values from the feature class.

Tip:

Because query layers access databases directly using SQL, the data does not have to be part of an enterprise geodatabase, but you can define query layers for enterprise geodatabase tables and feature classes if you need to.

You define an SQL query to create a query layer. The query runs against the tables and views in the database or cloud data warehouse you specify, and the result set is added to the map as a layer if your query includes a spatial column or a stand-alone table if it does not.

The SQL query that defines a query layer is a static SQL statement that is executed inside the database or data warehouse every time the layer is displayed or used in the map. This allows the latest information to be visible without making a copy or snapshot of the data. This is especially useful when working with dynamic information that is frequently changing. However, there are many situations where parts of SQL statements are not known in advance. For example, to display aggregated rainfall in a region, you may not know beforehand whether to aggregate the rainfall station values by day, week, or month. Parameters in query layers can help make components of SQL statements dynamic.

Keep the following in mind when working with query layers:

Related topics