You can edit and run SQL statements in the SQL job editor to execute data query.
The editor supports SQL:2003 and is compatible with Spark SQL. For details about the syntax, see .
To access the SQL editor, choose SQL Editor in the left navigation pane of the DLI console, or click Create Job in the upper right corner of the Job Management > SQL Jobs page.
This topic describes the main functions of the SQL editor.
You cannot view job logs if you choose not to create the bucket. The bucket name will be set by the system.
On the OBS console, you can configure lifecycle rules for a bucket to periodically delete objects in it or change object storage classes.
The navigation pane on the left consists of Databases, Queues, and Templates tabs.
No. |
Name |
Description |
---|---|---|
1 |
Databases |
Displays all the existing databases and tables in these databases.
|
2 |
Queues |
Displays existing queues. |
3 |
Templates |
Click the drop-down button to view 22 built-in standard TPC-H query templates and custom templates. |
SQL job editing window is displayed in the upper right part of the page. For details about the parameters, see Table 2.
The SQL statement editing area is below the operation bar. For details about keyboard shortcuts, see Table 3.
No. |
Button & Drop-Down List |
Description |
---|---|---|
2 |
Queues |
Select a queue from the drop-down list box. If no queue is available, the default queue is displayed. Refer to Creating a Queue and create a queue. SQL jobs can only be executed on SQL queues. |
3 |
Database |
Select a database from the drop-down list box. If no database is available, the default database is displayed. For details about how to create a database, see Creating a Database or a Table. NOTE:
If you specify the database in the SQL statements, the database you choose from the drop-down list will not be used. |
4 |
Execute |
Click this button to run the SQL statements in the job editing window. |
5 |
Format |
Click this button to format the SQL statements. |
6 |
Syntax Reference |
Click this button to view the Data Lake Insight SQL Syntax Reference. |
7 |
Settings |
Add parameters and tags. Parameter Settings: Set parameters in key/value format for SQL jobs. Tags: Set tags in key/value format for SQL jobs. |
8 |
More |
The drop-down list includes the following options:
|
Shortcut |
Description |
---|---|
Ctrl+Enter |
Execute SQL statements. You can run SQL statements by pressing Ctrl+R or Ctrl + Enter on the keyboard. |
Ctrl+F |
Search for SQL statements. You can press Ctrl+F to search for a required SQL statement. |
Shift+Alt+F |
Format SQL statements. You can press Shift + Alt + F to format a SQL statement. |
Ctrl+Q |
Syntax verification. You can press Ctrl + Q to verify the syntax of SQL statements. |
F11 |
Full screen. You can press F11 to display the SQL Job Editor window in full screen. Press F11 again to leave the full screen. |
After the SQL job is executed, you can view the execution history and result in the lower part of the editing area.
You can filter the execution history in the following ways:
Area |
Description |
---|---|
Executed Queries (Last Day) |
The latest daily information about the submitted jobs, including the following items:
|
Operation |
Description |
---|---|
Clear the result |
Clear the displayed SQL statement query results. |
View chart/table |
Click |
Export job results |
Export the job execution results to the created OBS bucket. |
On the SQL editor page, the system prompts you to create an OBS bucket to store temporary data generated by DLI jobs. In the Set Job Bucket dialog box, click Setting. On the page displayed, click the edit button in the upper right corner of the job bucket card. In the Set Job Bucket dialog box displayed, enter the job bucket path and click OK.
1 | SELECT * FROM qw.qw LIMIT 10; |
Alternatively, you can double-click the table name qw. The query statement is automatically entered in the SQL job editing window.
To use the SQL statement template, click Templates from the left pane of the SQL editor page. Double-click the required template in the template list, and modify it as required before executing the SQL statements.