Skip to main content

Connect to DLF Paimon

Connect a VeloDB Cloud warehouse to the Paimon REST catalog provided by Alibaba Cloud Data Lake Formation (DLF). This workflow requires DLF 2.5 or later. The example uses DLF credentials for metadata access and temporary credentials returned by DLF for OSS access. The VPC endpoint requires connectivity from the warehouse; the external Spark configuration runs in your Alibaba Cloud environment.

Prerequisites​

  • Connect to a VeloDB Cloud warehouse with a SQL user allowed to create catalogs and use the required databases and tables.
  • For SaaS and BYOC warehouses, configure network access from the warehouse to both the external catalog endpoint and the storage endpoints returned in table metadata. An endpoint reachable from your laptop may still be unreachable from the warehouse. Contact VeloDB Cloud support when the integration needs private networking or managed runtime configuration.
  • Prepare external service permissions for the metadata and data operations you plan to run. Credential vending still requires the external service to grant storage access.
  • Replace sample hosts, account IDs, bucket names, and credentials. The HTTP endpoints and development credentials in local service examples are for an isolated test environment. Use HTTPS and restricted credentials for remote access.

Use the integration​

01 Enable the DLF service​

Please refer to the DLF official documentation to enable the DLF service and create the corresponding Catalog, Database, and Table.

02 Access DLF using EMR Spark SQL​

  • Connect

    spark-sql --master yarn \
    --conf spark.driver.memory=5g \
    --conf spark.sql.defaultCatalog=paimon \
    --conf spark.sql.catalog.paimon=org.apache.paimon.spark.SparkCatalog \
    --conf spark.sql.catalog.paimon.metastore=rest \
    --conf spark.sql.extensions=org.apache.paimon.spark.extensions.PaimonSparkSessionExtensions \
    --conf spark.sql.catalog.paimon.uri=http://<region>-vpc.dlf.aliyuncs.com \
    --conf spark.sql.catalog.paimon.warehouse=<your-catalog-name> \
    --conf spark.sql.catalog.paimon.token.provider=dlf \
    --conf spark.sql.catalog.paimon.dlf.token-loader=ecs

    Replace the corresponding warehouse and uri addresses.

  • Write Data

    USE <your-catalog-name>;

    CREATE TABLE users_samples
    (
    user_id INT,
    age_level STRING,
    final_gender_code STRING,
    clk BOOLEAN
    );

    INSERT INTO users_samples VALUES
    (1, '25-34', 'M', true),
    (2, '18-24', 'F', false);

    INSERT INTO users_samples VALUES
    (3, '25-34', 'M', true),
    (4, '18-24', 'F', false);

    INSERT INTO users_samples VALUES
    (5, '25-34', 'M', true),
    (6, '18-24', 'F', false);

    If you encounter the following error, try removing paimon-jindo-x.y.z.jar from /opt/apps/PAIMON/paimon-dlf-2.5/lib/spark3, then restart the Spark service and retry.

    Ambiguous FileIO classes are:
    org.apache.paimon.jindo.JindoLoader
    org.apache.paimon.oss.OSSLoader

03 Connect to DLF from VeloDB Cloud​

  • Create Paimon Catalog

    CREATE CATALOG paimon_dlf_test PROPERTIES (
    'type' = 'paimon',
    'paimon.catalog.type' = 'rest',
    'uri' = 'http://<region>-vpc.dlf.aliyuncs.com',
    'warehouse' = '<your-catalog-name>',
    'paimon.rest.token.provider' = 'dlf',
    'paimon.rest.dlf.access-key-id' = '<ak>',
    'paimon.rest.dlf.access-key-secret' = '<sk>'
    );
    • VeloDB Cloud uses the temporary credentials returned by DLF to access OSS object storage, so no additional OSS credentials are required.
    • DLF can only be accessed within the same VPC. Ensure you provide the correct URI address.
  • Query Data

    SELECT * FROM users_samples ORDER BY user_id;
    +---------+-----------+-------------------+------+
    | user_id | age_level | final_gender_code | clk |
    +---------+-----------+-------------------+------+
    | 1 | 25-34 | M | 1 |
    | 2 | 18-24 | F | 0 |
    | 3 | 25-34 | M | 1 |
    | 4 | 18-24 | F | 0 |
    | 5 | 25-34 | M | 1 |
    | 6 | 18-24 | F | 0 |
    +---------+-----------+-------------------+------+
  • Query System Tables

    SELECT snapshot_id, commit_time, total_record_count FROM users_samples$snapshots;
    +-------------+-------------------------+--------------------+
    | snapshot_id | commit_time | total_record_count |
    +-------------+-------------------------+--------------------+
    | 1 | 2025-08-09 05:56:02.906 | 2 |
    | 2 | 2025-08-13 03:41:32.732 | 4 |
    | 3 | 2025-08-13 03:41:35.218 | 6 |
    +-------------+-------------------------+--------------------+
  • Incremental Reading

    SELECT * FROM users_samples@incr('startSnapshotId'=1, 'endSnapshotId'=2) ORDER BY user_id;
    +---------+-----------+-------------------+------+
    | user_id | age_level | final_gender_code | clk |
    +---------+-----------+-------------------+------+
    | 3 | 25-34 | M | 1 |
    | 4 | 18-24 | F | 0 |
    +---------+-----------+-------------------+------+

Common errors​

SymptomCheck and resolution
Connection timeout or hostname resolution failureCheck the catalog URI and connectivity from the warehouse, then check the storage endpoints in table metadata. Ask VeloDB Cloud support to investigate managed network access when needed.
Unauthorized or forbidden responseCheck the catalog authentication method, token or client credentials, expiry, and permissions on the external catalog and namespace.
Catalog metadata loads but a table scan failsCheck storage credentials or credential vending, object permissions, and reachability of the data-file endpoint. Metadata access alone does not grant data access.

Clean up test resources​

Queries and writes consume warehouse compute, and the sample can create billable external storage or services. See Billing Overview. Remove only the test tables and external services you created when you finish. Check the external catalog's deletion behavior before dropping a table or namespace because it can also delete data files.

Ask AI