After configuring a DLF-Legacy catalog, you can directly access its tables from the Realtime Compute for Apache Flink console. This eliminates the need to manually register Data Lake Formation (DLF) tables, improving development efficiency and ensuring data integrity. This topic describes how to create, view, use, and delete a DLF-Legacy catalog.
This topic applies only to DLF-Legacy. We recommend that you use the latest version of Data Lake Formation (DLF) instead of DLF-Legacy. For more information about how to use the new version of DLF, see Manage Paimon catalogs.
Background information
Alibaba Cloud Data Lake Formation (DLF) is a unified metadata management service. You can use DLF to manage tables in open source formats, such as Iceberg, Hudi, Delta, Parquet, ORC, and Avro.
Prerequisites
The DLF-Legacy service has been activated
Limitations
In a DLF-Legacy catalog, Flink can manage only tables in the Iceberg and Hudi data lake formats.
Create a DLF-Legacy catalog
You can create a DLF-Legacy catalog using the UI or SQL commands. We recommend using the UI.
Use the UI
-
Go to the Catalogs page.
-
Log on to the Realtime Compute for Apache Flink console.
-
In the Actions column of the target workspace, click Console.
-
Click Catalogs.
-
-
Click Create Catalog, select DLF, and then click Next.
-
Create the DLF-Legacy catalog.
-
Configure the catalog parameters.
Parameter
Description
Required
Remarks
catalogname
The name of the DLF-Legacy catalog.
Yes
Enter a custom name in English.
access.key.id
The AccessKey ID to access Object Storage Service (OSS).
Yes
For more information, see Obtain an AccessKey pair.
access.key.secret
The AccessKey Secret to access Object Storage Service (OSS).
Yes
For more information, see Obtain an AccessKey pair.
warehouse
The default OSS path where tables in the DLF-Legacy catalog are stored.
Yes
Both OSS and OSS-HDFS are supported.
-
OSS path format:
oss://<bucket>/<object> -
OSS-HDFS path format:
oss://<bucket>.<oss-hdfs-endpoint>/<object>
The placeholders are described as follows:
-
bucket: The name of your OSS bucket. You can view the bucket name in the OSS console.
-
object: The path where your data is stored. You can view the path in the OSS console.
-
oss-hdfs-endpoint: The endpoint of the OSS-HDFS service. In the OSS console, on the Overview page of a bucket, view the endpoint of the HDFS service in the Access Ports section.
NoteThis parameter can be set to an OSS-HDFS path only in VVR 8.0.3 and later.
oss.endpoint
The endpoint of Alibaba Cloud OSS. For example,
oss-cn-hangzhou-internal.aliyuncs.com.Yes
Both OSS and OSS-HDFS are supported.
-
OSS service endpoint. For more information, see Regions and endpoints.
-
OSS-HDFS service endpoint. In the OSS console, on the Overview page of a bucket, view the endpoint of the HDFS service in the Access Ports section.
Note-
We recommend that you set the oss.endpoint parameter to a VPC endpoint for OSS. For example, if you are in the China (Hangzhou) region, set oss.endpoint to
oss-cn-hangzhou-internal.aliyuncs.com. -
If you need to access OSS across VPCs, see How do I access other services across VPCs?.
dlf.endpoint
The endpoint of the Alibaba Cloud DLF service.
Yes
Note-
We recommend that you set the dlf.endpoint parameter to a VPC endpoint for DLF. For example, if you are in the China (Hangzhou) region, set the dlf.endpoint parameter to
dlf-vpc.cn-hangzhou.aliyuncs.com. -
If you need to access DLF across VPCs, see Workspace management and operations.
dlf.region-id
The region ID of the Alibaba Cloud DLF service.
Yes
NoteMake sure that the region ID is consistent with the region of the dlf.endpoint.
Configurations
Additional DLF settings. For example, to specify multiple DLF catalogs, enter each on a new line.
No
For example:
dlf.catalog.id:my_catalog. -
-
Click Confirm.
-
-
After the catalog is created, you can view it in the Catalogs section.
Use SQL commands
-
In the text editor on the Scripts page, enter the command to create a DLF-Legacy catalog.
CREATE CATALOG <yourcatalogname> WITH ( 'type' = 'dlf', 'access.key.id' = '<YourAliyunAccessKeyId>', 'access.key.secret' = '<YourAliyunAccessKeySecret>', 'warehouse' = '<YourAliyunOSSLocation>', 'oss.endpoint' = '<YourAliyunOSSEndpoint>', 'dlf.region-id' = '<YourAliyunDLFRegionId>', 'dlf.endpoint' = '<YourAliyunDLFEndpoint>' );Parameter
Description
Required
Remarks
yourcatalogname
A custom name for the DLF-Legacy catalog.
Yes
Enter a custom name in English.
ImportantAfter you replace the parameter with your catalog name, remove the angle brackets (<>). Otherwise, a syntax error occurs.
type
The type of the catalog.
Yes
Set this parameter to
dlf.access.key.id
The AccessKey ID of your Alibaba Cloud account.
Yes
For more information, see Obtain an AccessKey pair.
access.key.secret
The AccessKey Secret of your Alibaba Cloud account.
Yes
For more information, see Obtain an AccessKey pair.
warehouse
The default OSS path for tables in the DLF-Legacy catalog.
Yes
The format is oss://<bucket>/<object>. The placeholders are described as follows:
-
bucket: The name of your OSS bucket.
-
object: The path where your data is stored.
NoteYou can view your bucket and object names in the OSS console.
oss.endpoint
The endpoint of Alibaba Cloud OSS.
Yes
For more information, see Regions and endpoints.
Note-
We recommend that you set the oss.endpoint parameter to a VPC endpoint for OSS. For example, if you are in the China (Hangzhou) region, set oss.endpoint to
oss-cn-hangzhou-internal.aliyuncs.com. -
If you need to access OSS across VPCs, see Workspace management and operations.
dlf.endpoint
The endpoint of the Alibaba Cloud DLF service.
Yes
Note-
We recommend that you set the dlf.endpoint parameter to a VPC endpoint for DLF. For example, if you are in the China (Hangzhou) region, set the dlf.endpoint parameter to
dlf-vpc.cn-hangzhou.aliyuncs.com. -
If you need to access DLF across VPCs, see Workspace management and operations.
dlf.region-id
The region ID of the Alibaba Cloud DLF service.
Yes
NoteMake sure that the region ID is consistent with the region of the dlf.endpoint.
-
-
Select the statement and click Run.
-
In the Catalogs section on the left, view the created catalog.
View a DLF-Legacy catalog
After creating a DLF-Legacy catalog, you can view its metadata.
-
Go to the Catalogs page.
-
Log on to the Realtime Compute for Apache Flink console.
-
In the Actions column of the target workspace, click Console.
-
Click Catalogs.
-
-
On the Catalog list page, you can view the Name and Type.
NoteTo view the databases and tables in a catalog, click View.
Use a DLF-Legacy catalog
Manage DLF databases
In the text editor on the Scripts page, enter the following statements. Select a statement and click Run. After the database is created or deleted, you can verify the result in the Catalogs section on the left side of the SQL Editor page.
-
Create a database
CREATE DATABASE dlf.dlf_testdb; -
Delete a database
DROP DATABASE dlf.dlf_testdb;
Manage DLF tables
-
Create a table
-
Create a table by using a connector
SQL
In the text editor on the Scripts page, enter a statement. Select the statement and click Run. After the table is created, you can view it in the Catalogs section on the left side of the SQL Editor page.
CREATE TABLE dlf.dlf_testdb.iceberg ( id BIGINT, data STRING, dt STRING ) PARTITIONED BY (dt) WITH( 'connector' = 'iceberg' ); CREATE TABLE dlf.dlf_testdb.hudi ( id BIGINT PRIMARY KEY NOT ENFORCED, data STRING, dt STRING ) PARTITIONED BY (dt) WITH( 'connector' = 'hudi' );UI
-
Go to the Catalogs page.
-
Log on to the Realtime Compute for Apache Flink console.
-
In the Actions column of the target workspace, click Console.
-
Click Catalogs.
-
-
In the Actions column of the target catalog, click View.
-
In the Actions column of the target database, click View.
-
Click Create Table.
-
On the Built-in tab, click Connection Type and select a table type.
-
Click Next.
-
Enter the table creation statement and configure the parameters. The following code provides an example.
CREATE TABLE dlf.dlf_testdb.iceberg ( id BIGINT, data STRING, dt STRING ) PARTITIONED BY (dt) WITH( 'connector' = 'iceberg' ); CREATE TABLE dlf.dlf_testdb.hudi ( id BIGINT PRIMARY KEY NOT ENFORCED, data STRING, dt STRING ) PARTITIONED BY (dt) WITH( 'connector' = 'hudi' ); -
Click Confirm.
-
-
Create a table with a matching schema (This method is supported only for Iceberg tables.)
In the text editor on the Scripts page, enter the following statement. Select the statement and click Run.
CREATE TABLE iceberg_table_like LIKE iceberg_table;
-
-
Delete a table
DROP TABLE iceberg_table;
Modify Iceberg table schema
In the text editor on the Scripts page, enter the required command. Select the command and click Run.
|
Actions |
Example |
|
Change table properties |
|
|
Rename a table |
|
|
Rename a column |
Note
This feature is supported only in VVR 8.0.7 and later. |
|
Change a data type |
The following rules apply when you change the data type of a column:
Note
This feature is supported only in VVR 8.0.7 and later. |
Write data
INSERT INTO dlf.dlf_testdb.iceberg VALUES (1, 'AAA', '2022-02-01'), (2, 'BBB', '2022-02-01');
INSERT INTO dlf.dlf_testdb.hudi VALUES (1, 'AAA', '2022-02-01'), (2, 'BBB', '2022-02-01');
Read data
SELECT * FROM dlf.dlf_testdb.iceberg LIMIT 2;
SELECT * FROM dlf.dlf_testdb.hudi LIMIT 2;
Delete a DLF-Legacy catalog
Deleting a DLF-Legacy catalog does not affect running deployments. However, deployments that use the catalog may fail upon restart or republication because they can no longer find the tables. Proceed with caution.
You can delete a DLF-Legacy catalog using the UI or SQL commands. We recommend using the UI.
Use the UI
-
Go to the Catalogs page.
-
Log on to the Realtime Compute for Apache Flink console.
-
In the Actions column of the target workspace, click Console.
-
Click Catalogs.
-
-
On the Catalog list page, click Delete in the Actions column of the target catalog.
-
In the confirmation message that appears, click Delete.
-
In the Catalogs section on the left, verify that the target catalog has been deleted.
Use SQL commands
-
In the text editor on the Scripts page, enter the following command.
DROP CATALOG ${catalog_name}Replace ${catalog_name} with the name of the DLF-Legacy catalog to delete.
-
Select the command and click Run.
-
In the Catalogs section on the left, verify that the target catalog has been deleted.
Related documents
-
For more information about how to use the Iceberg connector, see Iceberg connector.
-
For more information about how to use the Hudi connector, see Hudi connector (retiring).
-
If the built-in catalogs do not meet your business requirements, you can create a custom catalog. For more information, see Manage custom catalogs.