Create a query layer with the ArcGIS Pro assistant (beta)
You can create query layers by connecting to a database and using the ArcGIS Pro assistant (beta) to ask natural language questions about it. For the specified database connection and table schemas, the assistant generates SQL queries whose results you can add to a map as a query layer.
The assistant does not work with file geodatabases because query layers are not supported on file geodatabases.
Create a query layer
To create query layers using the assistant, complete the following steps:
In the Assistant (Beta) pane, click the Query Layer card, or click the menu button
and click Query Layer
.Under Data context, click the Databases drop-down arrow and click the name of a database to use.
Click the Tables drop-down arrow and click the name of one or more tables in the selected database.
In the prompt text box, enter a question about the selected tables in conversational language.
Press Enter or click Ask the question
to submit the prompt.When a valid query is generated, the SQL statement displays, along with options to modify the query and add it as a layer in a map.
Note:
The Share feedback and schema for invalid queries check box is checked by default. If an invalid query is generated, the Query Layer Assistant Feedback dialog box appears. The query is recorded automatically—you don't need to paste it into the feedback box. You can click Submit to submit the invalid query for review.
If you prefer not to share feedback, you can uncheck the check box before submitting the prompt.
Optionally, click the Explanation drop-down arrow to see an explanation of the SQL query and how it was generated.
Tip:
You can click Edit Query to open the Edit Query Layer dialog box. This allows you to modify the query—for example, to change a field name or a value—without asking another question.
Add a query layer in one of the following ways:
Click Add to Current Map
to add the query as a layer in the current map.Click Add to New Map
to add the query as a layer in a new map.
Tip:
You can also initiate the query layer creation workflow in the ArcGIS Pro Actions mode of the assistant by entering a natural-language prompt to use SQL (for example, you can type Use SQL to find tornadoes within 1/2 mile of highways).
Resolve failure to add the query as a layer
If the generated query is valid but the operation to add the query as a layer in a map fails, an error message appears with an instruction to review the fields used in the SQL statement. You may also see a follow-up suggestion to analyze the SQL error and retry the original request. To apply the suggestion, complete the following steps:
Under Suggested Follow Ups, click Analyze response with error, sql and retry original request.
Press Enter or click Ask the question to submit the prompt.
The assistant analyzes the query and uses prompts written in the SQL skill to update the SQL statement so that it returns at least one record.
Click Add to Current Map
or click Add to New Map
to add the updated query as a layer in a map.