Query Editor is an interactive tool provided by Adobe Experience Platform Query Service, which allows you to write, validate, and run queries for customer experience data within the Experience Platform user interface. Query Editor supports developing queries for analysis and data exploration, and allows you to run interactive queries for development purposes as well as non-interactive queries to populate datasets in Experience Platform.
For more information about the concepts and features of Query Service, see the Query Service overview. To learn more about how to navigate the Query Service user interface on Platform, see the Query Service UI overview.
Query Editor provides flexible execution of queries by connecting to Query Service, and queries will only run while this connection is active.
Query Editor takes a few seconds to initialize and connect to Query Service when it is opened. The console tells you when it is connected, as shown below. If you attempt to run a query before the editor has connected, it delays execution until the connection is complete.
Queries executed from Query Editor run interactively. This means that if you close the browser or navigate away, the query is canceled. This is also true for queries made to generate datasets from query outputs.
Using Query Editor, you can write, execute, and save queries for customer experience data. All queries executed, or saved in Query Editor are available to all users in your organization with access to Query Service.
In the Experience Platform UI, select Queries in the left navigation menu to open the Query Service workspace. Next, select Create Query at the top right of the screen to start writing queries. This link is available from any of the pages in the Query Service workspace.
Query Editor is organized to make writing queries as easy as possible. The screenshot below shows how the editor appears in the UI, with the SQL entry field and Play highlighted.
To minimize your development time, it is recommended that you develop your queries with limits on the rows returned. For example,
SELECT fields FROM table WHERE conditions LIMIT number_of_rows. After you have verified that your query produces the expected output, remove the limits and run the query with
CREATE TABLE tablename AS SELECT to generate a dataset with the output.
SELECTfrom, then use the arrow keys to navigate to the table you are looking for, and press Enter. Once a table is selected, autocomplete will recognize fields in that table.
The auto-complete UI configurational toggle is currently in a limited release and not available to all customers.
The Query Editor automatically suggests potential SQL keywords along with table or column details for the query as you write it. The auto-complete feature is enabled by default and can be disabled or enabled at any point by selecting the Syntax auto-complete toggle to the top right of the Query Editor.
The auto-complete configuration setting is per user and remembered for the consecutive logins for that user.
Disabling this feature stops several metadata commands from being processed and providing recommendations that typically benefit the speed of the author when editing queries.
When you use the toggle to enable the auto-complete feature, recommended suggestions for table and column names as well as SQL keywords become available after a short pause. A success message in the console beneath the Query Editor indicates the feature is active.
If you disable the auto-complete feature, a page refresh is required for the feature to take effect. A confirmation dialog appears with three options when you disable the Syntax auto-complete toggle :
If you are writing or editing a query when disabling this feature, you must save any changes to your query before refreshing the page or all progress will be lost.
Select the appropriate option to disable the auto-complete feature.
Query Editor automatically validates a query as you write it, providing generic SQL validation and specific execution validation. If a red underline appears below the query (as shown in the image below), it represents an error within the query.
When errors are detected, you can view the specific error messages by hovering over the SQL code.
Select any saved template from the Templates tab to view it in the Query Editor. The query details panel provides more information and tools to manage the selected query.
This panel allows you to generate an output dataset directly from the UI, delete or name the displayed query, and add a schedule to the query.
This panel also shows useful metadata such as the last time the query was modified and who modified it, if applicable. To generate a dataset, select Output Dataset. The Output Dataset dialog appears. Enter a name and description, then select Run Query. The new dataset is displayed in the Datasets tab on the Query Service user interface on Platform.
Queries that have been saved as a template can be scheduled from the Query Editor. This allows you to automate query runs run on a custom cadence. You can schedule queries based on frequency, date, and time, and also choose an output dataset for your results if required. Query schedules can also be disabled or deleted through the UI.
Schedules are set from the Query Editor. The following is a list of limitations for scheduled queries when using the Query Editor. They do not apply to the Query Service API:
Any scheduled queries are added to the list in the Scheduled queries tab. From that workspace you can monitor the status of all scheduled query jobs through the UI. On the Scheduled queries tab you can find important information about your query runs and subscribe to alerts. The available information includes the status, schedule details, and error messages/codes should a run fail. See the Monitor scheduled queries document for more information.
The Query Editor provides a save function that allows you to save a query and work on it later. To save a query, select Save in the top right corner of Query Editor. Before a query can be saved, a name must be provided for the query using the Query Details panel.
Queries named and saved in using the Query Editor are available as templates within the Query dashboard Templates tab. See the templates documentation for more information.
All queries executed from Query Editor are captured in the Log table. You can use the search functionality in the Log tab to find query executions. Saved queries are listed in the Templates tab.
If a query was scheduled, then the Scheduled Queries tab provides improved visibility through the UI for those query jobs. See the query monitoring documentation for more information.
Queries that are not executed are not saved by the Log. In order for the query to be available in Query Service, it must be run or saved in Query Editor.
To run a query in Query Editor, you can enter SQL in the editor or load a previous query from the Log or Templates tab, and select Play. The status of query execution is displayed in the Console tab below, and output data is shown in the Results tab.
The console provides information on the status and operation of Query Service. The console displays the connection status to Query Service, query operations being executed, and any error messages that result from those queries.
The console only shows errors that resulted from executing a query. It does not show query validation errors before a query is executed.
After a query has been completed, the results are displayed in the Results tab, next to the Console tab. This view shows the tabular output of your query, displaying up to 100 rows. This view allows you to verify that your query produces the expected output. To generate a dataset with your query, remove limits on rows returned, and run the query with
CREATE TABLE tablename AS SELECT to generate a dataset with the output. See the generating datasets tutorial for instructions on how to generate a dataset from query results in Query Editor.
The following video shows how to run queries in the Adobe Experience Platform interface and in a PSQL client. Additionally, using individual properties in an XDM object, using Adobe-defined functions, and using CREATE TABLE AS SELECT (CTAS) are demonstrated.
Now that you know what features are available in Query Editor and how to navigate the application, you can start authoring your own queries directly in Platform. For more information about running SQL queries against datasets in Data Lake, see the guide on running queries.