Updated on 2026-01-09 GMT+08:00

Creating a DLI Table and Associating It with OpenTSDB

Function

The CREATE TABLE statement is used to create a DLI table and associate it with existing metrics in OpenTSDB. This syntax supports the OpenTSDB of CloudTable and MRS.

Prerequisites

Before creating a DLI table and associating it with OpenTSDB, you need to create a datasource connection.

Syntax

1
2
3
4
5
CREATE TABLE [IF NOT EXISTS] UQUERY_OPENTSDB_TABLE_NAME
  USING OPENTSDB OPTIONS (
  'host' = 'xx;xx',
  'metric' = 'METRIC_NAME',
  'tags' = 'TAG1,TAG2');

Keywords

Table 1 CREATE TABLE keywords

Parameter

Description

host

OpenTSDB IP address.

Create a datasource connection before you can obtain this IP address.

  • After successfully created a connection, you can access the CloudTable OpenTSDB by entering the IP address of the OpenTSDB.
  • You can also access the MRS OpenTSDB. If you have created an enhanced datasource connection, enter the IP address and port number of the node where the OpenTSDB is located. The format is IP:PORT. If the OpenTSDB has multiple nodes, enter one of the node IP addresses.

metric

Name of the metric in OpenTSDB corresponding to the DLI table to be created.

tags

Tags corresponding to the metric. The tags are used for classification, filtering, and quick retrieval. You can set 1 to 8 tags, which are separated by commas (,). The parameter value includes values of all tagKs in the corresponding metric.

Precautions

When creating a DLI table, there is no need to specify the timestamp and value fields. The system will automatically construct the fields based on the specified tags, including the following fields, where TAG1 and TAG2 are determined by tags.

  • TAG1 String
  • TAG2 String
  • timestamp Timestamp
  • value double

Example

1
2
3
4
5
CREATE table opentsdb_table
  USING OPENTSDB OPTIONS (
  'host' = 'opentsdb-3xcl8dir15m58z3.cloudtable.com:4242',
  'metric' = 'city.temp',
  'tags' = 'city,location');