Apache Paimon is a real-time Data Lake solution for stream and batch processing. It combines efficient storage with flexible computation and is designed for large-scale, real-time, and streaming data. Paimon provides comprehensive Catalog interface support for the Flink engine, allowing you to easily manage real-time Data Lake metadata.
Before creating a catalog, you need to create a relevant TOS bucket and catalog folder. For related documentation, see Create a bucket and Create a folder.
Note: Flink and TOS must be in the same Region, because Flink does not currently support cross-Region access to TOS buckets.
Select Data Directory - Catalog List - Create Catalog - Select Paimon Catalog:
Enter the Catalog name and TOS address.
Create the required TOS buckets and Catalog folders before creating a Catalog. For related documentation, see Create a bucket and Create a folder.
Additionally, you must:
Authorize the LAS Catalog in the permission management module. Refer to Permission Management for permission assignment. Because Flink will be used to create database tables and write data. Therefore, we recommend granting Flink developers Admin permissions for the Catalog. Ensure you can perform the following tasks.
After meeting the prerequisites, select the Paimon and LAS Catalog options in Data Catalog and fill in the parameters above:
Click OK to complete the creation.
Parameter name | Parameter description |
|---|---|
Catalog type | Filesystem and LAS data catalog types are currently supported. |
Catalog name | The name of the catalog in the Flink data catalog. After it is created, you can reference it by this name in Flink SQL and ad-hoc query tasks.
|
Warehouse path | The root directory for Paimon storage on TOS. Ensure this path is consistent with the Catalog TOS path set in the LAS Catalog. |
AccessKeyID | To create an AccessKeyID with a sub-account, ensure it has LASFullAccess permission and the required database table permissions. |
AccessKeySecret | To create an AccessKeySecret with a sub-account, ensure it has LASFullAccess permission and the required database table permissions. |
LAS Catalog Name | The name of the corresponding Catalog in LAS to be bound. |
Go to Data Catalog > Catalog List, select a catalog, and then select the Sync Catalog Metadata feature.
You can view the contents of all Paimon databases and tables in the Catalog:
Create a database in the Catalog to organize and manage tables.
CREATE DATABASE IF NOT EXISTS ${catalog_name}.${db_name};
${catalog_name}: The name of the Catalog. Use the same name as the Paimon Catalog created previously.${db_name}: A custom name for the Database.Create a table in the Database to define its structure and related configurations.
CREATE TABLE IF NOT EXISTS `${catalog_name}`.`${db_name}`.`${table_name}` ( word varchar, -- Example field cnt bigint, PRIMARY KEY (word) NOT ENFORCED ) WITH ( 'bucket' = '4', -- Controls the number of buckets. It is recommended that each bucket stores around 1 GB of data. 'changelog-producer' = 'input' -- Generates a changelog for downstream stream reading. );
${table_name}: A custom name for the table.bucket: The number of buckets. We recommend that each bucket stores approximately 1 GB of data.changelog-producer:
input to generate data based on new upstream data for downstream stream reading. For details, see Changelog output mechanismDetailed Selection. If a changelog is not needed, use the none option to save storage and write resources.Paimon query SQL supports both streaming and batch reads. Simply select the corresponding mode during the Flink runtime:
INSERT INTO `print_table` SELECT * FROM `paimon_test`.`default`.`doc_result`;
Additionally, the ad-hoc query feature enables data exploration with Flink SQL:
The Flink INSERT statement supports both streaming and batch write semantics. Simply select the appropriate execution mode at runtime:
INSERT INTO `paimon_test`.`default`.`doc_result` select t.word, count(1) from doc_source t GROUP BY t.word;
In addition to INSERT statements, Paimon also supports batch overwrites on tables and partitions:
-- Overwrites a non-partitioned table. INSERT OVERWRITE my_table SELECT ... -- Overwrite partitioned table INSERT OVERWRITE my_table PARTITION (key1 = value1, key2 = value2, ...) SELECT ...