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

Global Variables

Global variables can be used to simplify complex parameters. For example, long and difficult variables can be replaced to improve the readability of SQL statements.

Creating Variables

  1. In the navigation pane of the DLI console, click Global Variables.
  2. On the Global Variables page, click Create in the upper right corner to create a global variable.
    Table 1 Parameters description

    Parameter

    Description

    Variable

    Name of the created global variable.

    Value

    Global variable value.

  3. After creating a global variable, use {{xxxx}} in the SQL syntax to replace the parameter value set as the global variable. xxxx indicates the variable name. For example, in the table creation statement of DWS datasource connection, set the value dbadmin.customer of the dbtable parameter to the global variable abc. You can use {{abc}} to replace the actual variable value.
    CREATE TABLE 'dws_test_var'
      USING dws
      OPTIONS (
        'url''****', //Set the URL based on the site requirements.
        'dbtable' '{{abc}}',  
        'user' 'dbadmin',  
        'password' '123'
    )

Modifying Variables

On the Global Variables page, click Modify in the Operation column of a variable to modify the variable value.

Deleting Variables

On the Global Variables page, click Delete in the Operation column of a variable to delete the variable value.

  • Only the user who creates a global variable can delete the variable.
  • After a variable is deleted, the variable cannot be used in SQL statements.