Help Center/ Data Lake Insight/ User Guide/ Submitting a SQL Job Using DLI/ Creating and Managing SQL Job Templates/ Developing and Submitting a SQL Job Using a SQL Job Template
Updated on 2024-11-08 GMT+08:00

Developing and Submitting a SQL Job Using a SQL Job Template

DLI allows you to create custom templates or save currently used SQL statements as templates for quick and convenient SQL operations. Once a template is saved, you can execute SQL operations directly through the template without the need to write SQL statements.

The system offers sample templates that include various standard TPC-H query statements. You can choose to use one of these templates or create a custom template to create a SQL job.

This example shows how to use a TPC-H sample template to develop and submit a SQL job.

Procedure

  1. Log in to the DLI management console.
  2. In the navigation pane on the left, choose Job Templates > SQL Templates.
  3. On the displayed Sample Templates tab, find a sample template that matches your service scenario under tpchQuery and click Execute in the Operation column.
  4. In the upper part of the editing window, set Engine to Spark, Queues to default, and Databases to default, and click Execute.

  5. Check the query result on the View Result tab below the editing window.

This example uses the default queue and database preset in the system as an example. You can also run the command in a self-created queue and database.

For details, see Creating a Queue. For how to create a database, see Creating a Database.