This statement is used to create a DLI table and associate it with an existing HBase table.
In Spark cross-source development scenarios, there is a risk of password leakage if datasource authentication information is directly configured. You are advised to use the datasource authentication provided by DLI.
For details about how to add an IP-domain mapping, see Enhanced Datasource Connection in the Data Lake Insight User Guide.
1 2 3 4 5 6 7 8 9 | CREATE TABLE [IF NOT EXISTS] TABLE_NAME ( ATTR1 TYPE, ATTR2 TYPE, ATTR3 TYPE) USING [CLOUDTABLE | HBASE] OPTIONS ( 'ZKHost'='xx', 'TableName'='TABLE_IN_HBASE', 'RowKey'='ATTR1', 'Cols'='ATTR2:CF1.C1, ATTR3:CF1.C2'); |
1 2 3 4 5 6 7 8 9 | CREATE TABLE [IF NOT EXISTS] TABLE_NAME ( ATTR1 String, ATTR2 String, ATTR3 TYPE) USING [CLOUDTABLE | HBASE] OPTIONS ( 'ZKHost'='xx', 'TableName'='TABLE_IN_HBASE', 'RowKey'='ATTR1:2, ATTR2:10', 'Cols'='ATTR2:CF1.C1, ATTR3:CF1.C2' |
Parameter |
Description |
---|---|
USING [CLOUDTABLE | HBASE] |
Specify the HBase datasource to CLOUDTABLE or HBASE. The value is case insensitive. |
ZKHost |
ZooKeeper IP address of the HBase cluster. Before obtaining the ZooKeeper IP address, you need to create a datasource connection first..
NOTE:
|
TableName |
Specifies the name of a table that has been created in the HBase cluster. |
RowKey |
Specifies the row key field of the table connected to DLI. The single and composite row keys are supported. A single row key can be of the numeric or string type. The length does not need to be specified. The composite row key supports only fixed-length data of the string type. The format is attribute name 1:Length, attribute name 2:length. |
Cols |
Provides mappings between fields in the DLI table and columns in the HBase table. The mappings are separated by commas (,). In a mapping, the field in the DLI table is located before the colon (:) and information about the HBase table follows the colon (:). In the HBase table information, the column family and column name are separated using a dot (.). |
1 2 3 4 5 6 7 8 9 | CREATE TABLE test_hbase( ATTR1 int, ATTR2 int, ATTR3 string) using hbase OPTIONS ( 'ZKHost'='to-hbase-1174405101-CE1bDm5B.datasource.com:2181', 'TableName'='HBASE_TABLE', 'RowKey'='ATTR1', 'Cols'='ATTR2:CF1.C1, ATTR3:CF1.C2'); |