This topic provides the DDL syntax that is used to create a Tablestore dimension table, describes the parameters in the WITH and CACHE clauses, and provides answers to some commonly asked questions.

What is Tablestore?

Tablestore is a distributed NoSQL database service that is built on the Apsara distributed operating system of Alibaba Cloud. Tablestore uses sharding and load balancing technologies to seamlessly scale out services and handle concurrent transactions. You can use Tablestore to store and query large amounts of structured data in real time.

Prerequisites

A Tablestore data table is created. For more information, see Step 3: Create a data table.

Limits

Only Flink that uses Ververica Runtime (VVR) 2.0.0 or later supports Tablestore connectors.

DDL syntax

CREATE TABLE ots_dim (
  id int,
  len int,
  content STRING
) WITH (
  'connector'='ots',
  'endPoint'='<yourEndpoint>',
  'instanceName'='<yourInstanceName>',
  'tableName'='<yourTableName>',
  'accessId'='<yourAccessId>',
  'accessKey'='<yourAccessKey>'
);

Parameters in the WITH clause

Parameter Description Required Remarks
connector The type of the dimension table. Yes Set the value to ots.
instanceName The name of the Tablestore instance. Yes N/A.
tableName The name of the table. Yes N/A.
endPoint The endpoint of the Tablestore instance. Yes N/A.
accessId The AccessKey ID that is used to connect to the Tablestore instance. Yes N/A.
accessKey The AccessKey secret that is used to connect to the Tablestore instance. Yes N/A.
retryIntervalMs The retry interval. No Default value: 1000. Unit: milliseconds.
maxRetryTimes The maximum number of retries for writing data to the table. No Default value: 100.
connectTimeout The timeout period for a connector to connect to Tablestore. No Default value: 30000. Unit: milliseconds.
socketTimeout The socket timeout period for a connector to connect to Tablestore. No Default value: 30000. Unit: milliseconds.

Parameters in the CACHE clause

Parameter Description Remarks
cache The cache policy. Valid values:
  • None: indicates that data is not cached. This is the default value.
  • LRU: indicates that only the specified data in the dimension table is cached. Each time the system receives a data record, the system searches the cache. If the system does not find the record in the cache, the system searches for the data record in the physical dimension table.

    If you use this cache policy, you must configure the cacheSize and cacheTTLMs parameters.

cacheSize The maximum number of data records that can be cached. This parameter is available only if you set the cache parameter to LRU. Default value: 10000.
cacheTTLMs The cache timeout period. Unit: milliseconds. The setting of the cacheTTLMs parameter varies based on the value of the cache parameter.
  • If you set the cache parameter to None, the cacheTTLMs parameter can be left empty. This indicates that cache entries do not expire.
  • If you set the cache parameter to LRU, the cacheTTLMs parameter specifies the cache timeout period. By default, cache entries do not expire.