Help Center/ AI DataLake/ devg/ Paimon Development Guide/ Paimon on Flink/ Querying and Writing Data to a Paimon Table
Updated on 2026-11-06 GMT+08:00

Querying and Writing Data to a Paimon Table

Important Notes

  • The underlying file system (such as OBS) must be available.
  • PRIMARY KEY must be defined for a primary key table, and the primary key column cannot be NULL.
  • Checkpointing must be enabled for streaming writes to Paimon. Data is committed only when a checkpoint is triggered.
  • For primary key tables, it is recommended that the number of buckets matches the sink parallelism to avoid data skew.
  • The partition key of Paimon must be included in the primary key.
  • Flink streaming jobs do not support INSERT OVERWRITE.
  • Once a Paimon table is managed via a Catalog, renaming the table is not allowed.
  • Paimon does not support Sink materializer. Please set table.exec.sink.upsert-materialize to NONE.

Code Examples

  • Example 1: Append data without a primary key to a Paimon append table.
    CREATE CATALOG lf_paimon_catalog
    WITH
      (
        'type' = 'paimon',
        'metastore' = 'lakeformation'
      );
    
    CREATE DATABASE IF NOT EXISTS lf_paimon_catalog.paimon_db
    WITH (
      'location' = 'obs://bucket/path/paimon-warehouse/paimon_db'
    );
    
    CREATE TABLE IF NOT EXISTS lf_paimon_catalog.paimon_db.paimon_table (
      id BIGINT,
      customer_id STRING,
      amount DOUBLE,
      region STRING
    );
    
    CREATE TABLE kafka_source(
      id BIGINT,
      customer_id STRING,
      amount DOUBLE,
      region STRING
    )
    WITH
      (
        'connector' = 'kafka',
        'topic' = 'user-events',
        'properties.bootstrap.servers' = '127.0.0.1:9092',
        'properties.group.id' = 'flink-consumer-group',
        'scan.startup.mode' = 'latest-offset',
        'format' = 'json'
      );
    
    INSERT INTO
      lf_paimon_catalog.paimon_db.paimon_table 
    SELECT
      *
    FROM
      kafka_source;
  • Example 2: Read a Paimon append table.
    CREATE CATALOG lf_paimon_catalog
    WITH
      (
        'type' = 'paimon',
        'metastore' = 'lakeformation'
      );
    
    CREATE TABLE sink (
      id BIGINT,
      customer_id STRING,
      amount DOUBLE,
      region STRING
    )
    WITH
      ('connector' = 'print');
    
    INSERT INTO
      sink
    SELECT
      *
    FROM
      lf_paimon_catalog.paimon_db.paimon_table /*+ OPTIONS('streaming'='true', 'monitor-interval'='60s') */;