Updated on 2022-07-04 GMT+08:00

SQL Job Management

SQL jobs allow you to execute SQL statements entered in the SQL job editing window, import data, and export data.

SQL job management provides the following functions:

In addition, you can click Quick Links to switch to the details on User Guide.

Job Management page

On the Overview page, click SQL Jobs to go to the SQL job management page. Alternatively, you can click Job Management > SQL Jobs. The job list displays all SQL jobs. If there are a large number of jobs, they will be displayed on multiple pages. You can switch to the specified page as required. DLI allows you to view jobs in all statuses. By default, jobs in the job list are displayed in descending order according to the job creation time, with the most recently created jobs displayed at the top.

Table 1 Job management parameters

Parameter

Description

Queue

Name of the queue to which a job belongs

Created

Time when a job is created. Jobs can be displayed in ascending or descending order of the job creation time.

Job Type

Job type. The following values are available:

  • IMPORT: Indicates a job used for importing data to DLI.
  • EXPORT: Indicates a job used for exporting data from DLI.
  • DCL: Involves conventional DCLs and operations related to queue permissions.
  • DDL: Is consistent with conventional DDL operations, including creating and deleting databases and tables.
  • QUERY: Indicates a job used for querying data by running SQL statements.
  • INSERT: Indicates a job used for inserting data by running SQL statements.
  • UPDATE: Updates data.
  • DELETE: Deletes a SQL job.
  • DATA_MIGRATION: Indicates cloud data migration.
  • RESTART_QUEUE: Restarts a queue.
  • SCALE_QUEUE: Indicates that the queue specifications are changed (capacity expansion or reduction).

Status

Job status. The following values are available:

  • Running
  • Scaling
  • Submitting
  • Canceled
  • Finished
  • Failed

Statement

Displays the SQL statements for a job as well as descriptions about export and table creation operations.

You can click to copy the corresponding statement.

Duration

Running duration of a job

Operation

  • Cancel
    • You can terminate a job only when the job is in Submitting or Running status.
    • A job whose status is Finished, Failed, or Canceled cannot be terminated.
    • If the Cancel button is gray, you are not allowed to perform this operation.
  • SparkUI: After you click this button, the Spark job execution page is displayed.
  • In addition to the preceding operations, the following operation is available for QUERY jobs and asynchronous DDL jobs.
    • View Result: View the job running result.
    • Export Result: Export the job running result to the created OBS bucket. For details, see section Exporting Query Results.
  • In addition to the preceding operations, the EXPORT job also includes the following operations:
    • Download
  • Archive Log: Save job logs to the temporary OBS bucket created by DLI.
  • Export Log: Export logs to the created OBS bucket. If the job is in the Running state, logs cannot be exported.
    NOTE:

    You have the permission to create OBS buckets.

Searching for a Job

On the SQL Jobs page, you can filter jobs by using the following methods.

  • Select a queue name.
  • Set the date range.
  • Enter the statement or job ID.
  • Select the creation time in ascending or descending order.
  • Select a job type.
  • Select a job status
  • Select the job execution duration in ascending or descending order.

Viewing Job Details

On the SQL Jobs page, you can click in front of a job record to view details about the job.

Job details vary with job types. The following describes how to load data, create table, and select job.

  • load data (job type: IMPORT) includes the following information: Queue name, job ID, creation time, job type, job status, execution statement, running duration, scanned data, execution user, number of results, number of scanned data records, number of error records, database name, table name, file format, table header, and quoted characters, separator, data source path, escape character, import start time, import end time, date format, and timestamp format.
  • create table (job type: DDL) includes the following information: Queue name, job ID, creation time, job type, job status, execution statement, running duration, scanned data, and execution user.
  • select (job type: QUERY) includes the following information: Queue name, job ID, creation time, job type, job status, execution statement, running duration, number of results (successful and exported results), scanned data, execution user, and result status (running successfully, viewing results, running failure, and failure cause).

Terminating a Job

On the SQL Jobs page, you can click Terminate in the Operation column to stop a submitting or running job.

Exporting Query Results

You can export results on the SQL Jobs page or the SQL Editor page.

  • On the Job Management > SQL Jobs page, you can click More < Export Result in the Operation column to export the query result.
  • After the query statement is successfully executed on the SQL Editor page, click Export Result on the right of the View Result tab page to export the query result.

If no column of the numeric type is displayed in the query result, the result cannot be exported.

Table 2 Parameters

Parameter

Description

File Format

Format of the exported query result file. Formats other than JSON will be supported in later versions.

Queue

Select a queue.

Compression Format

Compression format of the data to be exported. The following options are supported:

  • none
  • bzip2
  • deflate
  • gzip

Storage Path

Enter or select an OBS path to store the result.

NOTE:
  • After selecting an OBS bucket, enter a name for the folder. If the folder does not exist, it will be created in OBS.
  • The folder name cannot contain the special characters of \ / : * ? "< > |, and cannot start or end with a dot (.).

Export Mode

Mode for saving the exported query result data.

  • New OBS directory: If the specified export directory exists, an error is reported and the export operation cannot be performed.
  • Existing OBS directory (Overwritten): If you create a file in the specified directory, the existing file will be overwritten.

Number of Results

Number of exported query results. If no value is entered or the value is 0, all results are exported.

Advanced Settings

Table Header: No/Yes

Whether the data to be exported contains table headers. This parameter is invalid only when Export Format is set to json. Formats other than JSON will be supported in later versions.

Click Advanced Settings and select the check box next to Table Header: No. If the check box is not selected, the table header is displayed. If the check box is deselected, no table header is displayed.