Query Editor UI guide

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.

Getting started

Query Editor provides flexible execution of queries by connecting to Query Service, and queries will only run while this connection is active.

Connecting to Query Service

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.

The console output of the Query Editor upon initial connection.

How queries are run from Query Editor

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.

Query authoring using Query Editor

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.

Accessing Query Editor

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.

The Queries workspace overview tab with Create query highlighted.

Writing queries

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.

The Query Editor with the SQL input 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.

Writing tools in Query Editor

  • Automatic syntax highlighting: Makes reading and organizing SQL easier.

An SQL statement in the Query Editor demonstrating syntax colour highlighting.

  • SQL keyword auto-complete: Start typing your query then use the arrow keys to navigate to the desired term and press Enter.

A few characters of SQL with the auto complete dropdown menu providing options from the Query Editor.

  • Table and field auto-complete: Start typing the table name you want to SELECT from, 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 Query Editor input displaying drop down table name suggestions.

(Limited release) Auto-complete UI configurational toggle

IMPORTANT

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.

Query Editor with the syntax auto-complete toggle highlighted.

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 :

  • Cancel
  • Save changes and refresh
  • Refresh without saving changes
IMPORTANT

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.

The confirmation dialog to disable the auto-complete feature.

Select the appropriate option to disable the auto-complete feature.

Error detection

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.

The Query Editor input displaying SQL underlined in red to indicate an error.

When errors are detected, you can view the specific error messages by hovering over the SQL code.

A dialog with an error message.

Query details

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.

The Query Editor with the query details panel highlighted.

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.

Scheduled queries

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:

  • You can only add a schedule to a query that has already been created, saved, and run.
  • You cannot add a schedule to a parameterized query.
  • Scheduled queries cannot contain an anonymous block.

See the query schedules documentation to learn how to create query schedules in the UI. Alternatively, to learn how to add schedules using the API, please read the scheduled queries endpoint guide.

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.

Saving queries

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.

NOTE

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.

How to find previous queries

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.

NOTE

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.

Executing queries using 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.

Console

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 tab of the Query Editor console.

NOTE

The console only shows errors that resulted from executing a query. It does not show query validation errors before a query is executed.

Query results

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 Results tab of the Query Editor console displaying the results of a query run.

Run queries with Query Service tutorial video

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.

Next steps

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.

On this page