SQL Editor Mode

SQL Editor is a mode for creating and editing queries using the Apache Drill SQL standard. For users with a background in SQL-based database environments, SQL Editor mode provides a powerful tool for creating custom datasets by writing code that extracts data from the data mart using the precise conditions and formatting required for its application.

The present article briefly introduces the Daybreak SQL Editor tool. It is assumed that readers are familiar with the SQL language already and are comfortable creating queries on their own.

Creating a New Query

To create a new query using the SQL editor, log in to the Daybreak app and click the new SQL query button from the menu area to create a new query.

new query

Alternatively, you can edit the SQL code for an existing query created with Natural Language Answers or the structured query wizard by clicking the "Preview in SQL" button in the query area.

Screenshot of the preview in SQL button

Directly editing SQL code is disabled by default for all new Daybreak queries created with Answers or the Wizard. In order to enable SQL editing for these queries, you must permanently convert them to a SQL query. To do this, click the "Convert to SQL" button from the SQL preview modal.

Convert to SQL mode

Daybreak will ask you to confirm that you would like to edit this query in SQL mode. Click "Use SQL Editor" to continue.

Once you have enabled SQL editing, the SQL editor will display a code editor with advanced features such as autocomplete and syntax highlighting.

sql editor window

Within the SQL editor view, you can toggle the display of the datamart schema with the "Show/Hide Schema" button. Clicking "Show Schema" in the upper right of the code editor window will display the datamart schema in a searchable form. This can be useful for finding fields of interest and understanding the SQL data types that must be used to manipulate and query these fields.

Show schema area