All Products
Search
Document Center

Hologres:Access MaxCompute Delta tables

Last Updated:Mar 26, 2026

Starting from Hologres V3.0.38, you can query MaxCompute Delta tables directly from Hologres without moving data. A Delta table is a MaxCompute table format for incremental data. It supports minute-level data imports, uses AliORC as the underlying file format, supports UPSERT semantics, and can read and write incremental data in Change Data Capture (CDC) format. For more information about Delta table concepts, see Terms.

Limitations

CapabilitySupport
Read the latest snapshot of a Delta tableSupported
Write data back from Hologres to a Delta tableNot supported

Prerequisites

Before you begin, ensure that you have:

Step 1: Create a Delta table in MaxCompute

Create a Delta table in MaxCompute using one of the following methods:

  • In DataWorks: attach a MaxCompute data source, then create the table from the DataWorks console.

  • Using the MaxCompute local client: run the SQL command directly.

The following example creates a partitioned Delta table named mf_dt:

CREATE TABLE IF NOT EXISTS mf_dt (
  pk  BIGINT NOT NULL PRIMARY KEY,
  val BIGINT NOT NULL
)
PARTITIONED BY (dd STRING, hh STRING)
TBLPROPERTIES ("transactional"="true");

The "transactional"="true" property marks the table as a Delta table.

Step 2: Write data to the Delta table

MaxCompute supports two methods for loading data into a Delta table:

The following example uses batch inserts to load data into the mf_dt table:

-- Append rows to the dd='01', hh='01' partition
INSERT INTO TABLE mf_dt PARTITION (dd='01', hh='01')
VALUES (3, 30), (4, 4), (5, 5);

-- Overwrite the dd='01', hh='01' partition with new data
INSERT OVERWRITE TABLE mf_dt PARTITION (dd='01', hh='01')
VALUES (1, 1), (2, 2), (3, 3);

Step 3: Map the MaxCompute project in Hologres

Create an external data source mapping in Hologres so it can discover and query the MaxCompute tables. Two mapping methods are available:

The following example creates an external database mapping for a MaxCompute project:

CREATE EXTERNAL DATABASE ext_database_mc WITH
  metastore_type 'maxcompute'
  mc_project      'mc_3_layer_project'
  comment         'mc three layer project';

After creating the mapping, verify that the schemas and tables are discoverable:

-- List all schemas in the external database
SELECT * FROM hologres.hg_external_schemas('ext_database_mc');

-- List all tables in the default schema
SELECT * FROM hologres.hg_external_tables('ext_database_mc', 'default');

Step 4: Query the Delta table

Before querying a Delta table, set the following GUC parameter at the session level:

SET hg_experimental_external_catalog_routing = 'odps:common_table';

Then query the table using the three-part name external_database.schema.table:

SELECT * FROM ext_database_mc.mc_schema_name.mf_dt;

What's next