Metadata refers to the databases and tables you reference in a streaming job. You can manage existing databases and tables in metadata, and quickly reference metadata in SQL job development.
Creating a database
Log in to the Stream Compute Service console, create a SQL job in Jobs as instructed in Creating a SQL Job, go to the Development & Testing* tab of the job, and operate the metadata via Database/Table references on the left. In the initial state, only the default directory [_dc]
and the default database [_db]
are there.
On the Database/Table references page, select Create > Create database in the top right corner, select a catalog and enter a database name in the pop-up window, and click Confirm**. Creating a table
Step 1. On the Database/Table references page, select Create > Create table in the top right corner, select a catalog and database in the pop-up window, click Next, and select a method (three options: Template, Custom, and Cloud resource) to create the table. If you select Custom or Cloud resource, enter the required connection information.
For the Custom method:
Step 2. Click Next to go to the DDL editor page, and select a custom connector as the Referenced package. For how to upload a custom connector, see Managing Dependencies. After editing DDL statements, click Syntax check to check whether there are syntax errors, and click Complete to save the created metadata table. Note
When creating a metadata table, you can set variables in the WITH parameters, and the variable naming rule is ${variable name}:default value}
, such as ${job_name}:job_test
.
Note
You cannot set custom variables for the connector
andversion
attributes.
Referencing metadata table in a SQL job
To directly reference a metadata table in a SQL job, hover the pointer over a target metadata table, and click Operation and Reference. A three-segment reference format is used, such as dc
.db
.test_table
. If parameters are used in the metadata table creation statements, click Replace table variables to replace parameters with actual values.
Table lineage
You can view the dependency of a metadata table using the table lineage. Specifically, hover the pointer over a target metadata table, click Operation, and select View lineage.
Editing DDL
You can edit the DDL of a metadata table as follows: Click Operation, and select Edit DDL. The WITH parameters can be edited, but the connector type cannot. After modifications are completed in the WITH parameter editor on the right, click Update DDL (updated DDL is displayed on the left), and click Save to complete the editing.
Was this page helpful?