Query Editor

Overview

Query Editor allows you to run queries directly in the browser to interact with data stored in SkySQL databases.

Query Editor

Query Editor
https://skysql.mariadb.com/workspace/query-editor

Prerequisite

  • Enterprise Server With Replica(s)

  • Xpand Distributed SQL

  • ColumnStore Data Warehouse

Access to Query Editor

To access Query Editor:

  1. Log in to the Unified Portal.

  2. Launch a compatible database service.

  3. Click "Workspace" in the main menu (left navigation in the Unified Portal).

  4. On the Workspace page, click the "Explore" button on the Query Editor card.

Alternatively, Query Editor can be accessed from the Dashboard by clicking on the service name of the desired service, then clicking on the "Query Editor" tab.

If your IP address or netblock has not yet been added to the Firewall allowlist, you will be prompted to do so.

With the cursor active on the editor, press the F1 key to view available commands.

Data Preview

To preview data:

  1. In the left sidebar, click the database name then click tables.

  2. Hover on the table name then left-click to show "Preview Data".

  3. Right-click to choose either "Preview Data" or "View Details" to generate data.

After modifying the schema (performing DDL), the left sidebar (Schemas) must be manually refreshed. To refresh the sidebar, click the Reload button to the right of the "Schemas" label.

Tab Interface

Query Editor features worksheet tabs. The default worksheet is "Query Tab 1".

Each worksheet is bound to a separate database connection.

Additional worksheets can be added using the "+" button to the right of the last worksheet tab.

Worksheets can be removed using the "X" button to the right of the worksheet tab label.

Editor Interface

Statements are entered into the editor interface, or can be loaded from file by clicking the Open Script icon above the editor text box.

Statements in the editor interface can be saved to file clicking the Save Script As icon above the editor text box.

To save statements within Query Editor for use later, click Create A Query Snippet icon above the editor text box.

Icons in the upper-right corner of the editor text box enable changes to Settings, and to minimize or maximize the editor text box.

Run SQL Statements

To access run SQL statements in Query Editor:

  1. Choose an existing database and table from the left sidebar.

  2. Write a SQL statement in the editor.

  3. Click the "run" button to execute all statements.

  4. Check your statements in the pop up window. Press the "Run" button to execute the statements.

View the Results

After running a SQL statement, you can view the query results.

A visual table with your queried data is created in the Results tab. To view the table:

  1. Click the "Results" tab under the Query Editor.

  2. Check the table in the "Results" tab.

  3. To filter the table data, click the "Filter By" button and select desired filters.

  4. To filter columns, click the "Columns" button and select desired filters.

  5. To export results, click the arrow down button on the bottom right.

View a Data Visualization

To view data visualizations:

  1. Click the "Show Visualized Configuration" button in the query editor bar.

  2. The visualizations are shown in the right sidebar. Select the desired graph type.

  3. Select result set.

Query Configuration

Query Configuration allows you to set row limits and query history retention period.

To set row limit and retention period:

  1. Click the "gear" icon in the Query Editor page (upper right).

  2. Select row limit.

  3. Enter query history retention period in days.

  4. Click the "Save" button.

History

History tracks executed SQL statements.

User query logs contain queries written in the SQL editor.

Action logs contain queries for SQL generated by Query Editor. Action logs include Preview Data (top 1000), View Details, Drop Table, and Truncate Table.

To view History in table form:

  1. Click the "HISTORY" button under the "History/Snippets" tab

  2. To filter results by search, enter a value in the search bar.

  3. Click the "Filter By" button. Select desired filter option ("User query logs" or "Action logs").

  4. To filter log types, click the "Log Types" button. Select desired logs.

The displayed columns can be customized by clicking the Filter Columns icon in the upper-right corner above the history table.

History data can be exported to file by clicking the Export Results icon in the upper-right corner above the history table. Data is written in either CSV (optionally with custom delimiters) or JSON.

Vertical mode can be enabled by clicking the Vertical query result button.

Snippets

Snippets are SQL statements saved within the Query Editor.

Statements can be saved as a Snippet using the Create A Query Snippet icon above the editor text box.

To view Snippets in table form:

  1. Click the "SNIPPETS" button under the "History/Snippets" tab

  2. To filter results by search, enter a value in the search bar.

  3. Click the "Filter By" button. Select desired filter option.

  4. Click the "Edit" button to edit existing snippets.

Snippets can be exported to file using the Save Script button. This feature requires use of Google Chrome or a Chromium-based browser.