Skip to main content

Exchange Data with MaxCompute

This document describes how to achieve data integration between VeloDB Cloud and Alibaba Cloud MaxCompute through MaxCompute Catalog:

  • Data Import: Quickly import data from MaxCompute into VeloDB Cloud for analysis.
  • Data write-back (experimental): Write analysis results or data from other sources in VeloDB Cloud back to MaxCompute.
  • Database and table management (experimental): Create and manage MaxCompute databases and tables from the warehouse.

The import examples originate in an Apache Doris 2.1.9 walkthrough. The write and metadata operations below are experimental upstream capabilities present in the Core 26.1.3 implementation; contact VeloDB Cloud support to establish their availability for your warehouse before planning a workflow that depends on them.

Prepare the environment​

01 Enable the MaxCompute Storage API​

In the MaxCompute Console, navigate to the left sidebar -> Tenant Management -> Tenant Properties -> Enable the Open Storage (Storage API) Switch

02 Grant MaxCompute permissions​

VeloDB Cloud uses AK/SK to access MaxCompute services. Ensure that the IAM user corresponding to the AK/SK has the following roles or permissions for the MaxCompute service:

{
"Statement": [
{
"Action": [
"odps:List",
"odps:Usage"
],
"Effect": "Allow",
"Resource": ["acs:odps:*:regions/*/quotas/pay-as-you-go"]
}
],
"Version": "1"
}

03 Configure warehouse connectivity to MaxCompute​

Configure connectivity from your SaaS or BYOC warehouse to the MaxCompute endpoint and any storage endpoints used by the connector. The upstream examples used a self-managed Apache Doris server in the same VPC as MaxCompute; that test does not establish connectivity or latency for your warehouse. Contact VeloDB Cloud support for a private networking path when needed.

Import MaxCompute data​

01 Create a catalog​

CREATE CATALOG mc PROPERTIES (
"type" = "max_compute",
"mc.default.project" = "<project-name>",
"mc.access_key" = "<access-key-id>",
"mc.secret_key" = "<secret-access-key>",
"mc.endpoint" = "<maxcompute-endpoint>"
);

To enable the MaxCompute schema hierarchy:

CREATE CATALOG mc PROPERTIES (
"type" = "max_compute",
"mc.default.project" = "<project-name>",
"mc.access_key" = "<access-key-id>",
"mc.secret_key" = "<secret-access-key>",
"mc.endpoint" = "<maxcompute-endpoint>",
"mc.enable.namespace.schema" = "true"
);

For more details, please refer to the MaxCompute Catalog documentation.

02 Import the TPC-H dataset​

We use the TPCH 100 dataset from MaxCompute public datasets as an example (data has already been imported into MaxCompute), and use the CREATE TABLE AS SELECT statement to import MaxCompute data into the warehouse.

This dataset contains 7 tables. The largest table lineitem has 16 columns, 600,037,902 rows, and occupies approximately 30GB of disk space.

-- switch catalog
SWITCH internal;
-- create database
CREATE DATABASE tpch_100g;
-- ingest data
CREATE TABLE tpch_100g.lineitem AS SELECT * FROM mc.selectdb_test.lineitem;
CREATE TABLE tpch_100g.nation AS SELECT * FROM mc.selectdb_test.nation;
CREATE TABLE tpch_100g.orders AS SELECT * FROM mc.selectdb_test.orders;
CREATE TABLE tpch_100g.part AS SELECT * FROM mc.selectdb_test.part;
CREATE TABLE tpch_100g.partsupp AS SELECT * FROM mc.selectdb_test.partsupp;
CREATE TABLE tpch_100g.region AS SELECT * FROM mc.selectdb_test.region;
CREATE TABLE tpch_100g.supplier AS SELECT * FROM mc.selectdb_test.supplier;

The upstream Apache Doris walkthrough reports approximately 6–7 minutes when these operations run serially on one 16-core, 64-GB backend. It does not specify the complete storage and query configuration; this is a historical observation, not a VeloDB Cloud measurement.

03 Import the GitHub Events dataset​

We use the GitHub Event dataset from MaxCompute public datasets as an example (data has already been imported into MaxCompute), and use the CREATE TABLE AS SELECT statement to import MaxCompute data into the warehouse.

Here we select data from 365 partitions of the dwd_github_events_odps table, from 2015-01-01 to 2016-01-01. The data contains 32 columns, 212,786,803 rows, and occupies approximately 10GB of disk space.

-- switch catalog
SWITCH internal;
-- create database
CREATE DATABASE github_events;
-- ingest data
CREATE TABLE github_events.dwd_github_events_odps
AS SELECT * FROM mc.github_events.dwd_github_events_odps
WHERE ds BETWEEN '2015-01-01' AND '2016-01-01';

The upstream Apache Doris walkthrough reports approximately 2 minutes on one 16-core, 64-GB backend. This is a historical observation, not a VeloDB Cloud measurement.

Write data back to MaxCompute​

The experimental write path can be used for the following scenarios after its warehouse availability is established:

  • Analysis Result Write-back: After completing data analysis in VeloDB Cloud, write the results back to MaxCompute for use by other systems.
  • Data Processing: Leverage VeloDB Cloud's powerful computing capabilities to perform ETL processing on data, and store the processed data in MaxCompute.
  • Cross-source Data Integration: Consolidate data from multiple sources in VeloDB Cloud and write it to MaxCompute for unified management.

Note:

  • This is an experimental capability; the upstream release number does not establish Cloud availability.
  • Supports writing to partitioned and non-partitioned tables.
  • This walkthrough covers ordinary partitioned and non-partitioned tables. The connector rejects MaxCompute external tables and logical views. Before using clustered, transactional, or Delta tables, establish their Storage API and warehouse support with VeloDB Cloud support.

01 Append data with INSERT INTO​

The INSERT operation appends data to the MaxCompute target table.

-- Switch to MaxCompute Catalog
SWITCH mc;

-- Insert a single row of data
INSERT INTO mc_db.mc_tbl VALUES (val1, val2, val3, val4);

-- Import data from Doris internal table to MaxCompute
INSERT INTO mc_db.mc_tbl SELECT col1, col2 FROM internal.db1.tbl1;

-- Write to specific columns
INSERT INTO mc_db.mc_tbl(col1, col2) VALUES (val1, val2);

-- Write to specific partition (you can specify only some partition columns, with the rest written dynamically)
INSERT INTO mc_db.mc_tbl PARTITION(ds='20250201') SELECT id, name FROM internal.db1.source_tbl;

02 Replace data with INSERT OVERWRITE​

INSERT OVERWRITE completely replaces the existing data in the table with new data.

-- Full table overwrite
INSERT OVERWRITE TABLE mc_db.mc_tbl VALUES (val1, val2, val3, val4);

-- Overwrite from another table
INSERT OVERWRITE TABLE mc_db.mc_tbl(col1, col2) SELECT col1, col2 FROM internal.db1.tbl1;

-- Overwrite specific partition
INSERT OVERWRITE TABLE mc_db.mc_tbl PARTITION(ds='20250101') VALUES (10, 'new1');

03 Create and populate a table with CTAS​

You can use the CREATE TABLE AS SELECT statement to create a new table in MaxCompute and write data to it.

-- Create table in MaxCompute and import data
CREATE TABLE mc_db.mc_new_tbl AS SELECT * FROM internal.db1.source_tbl;

Manage MaxCompute databases and tables​

The experimental metadata path can create and drop MaxCompute databases and tables. It can be used for the following scenarios after its warehouse availability is established:

  • Unified Data Management: Manage metadata from multiple data sources centrally in VeloDB Cloud, without switching to the MaxCompute console.
  • Automated Data Pipelines: Dynamically create target tables in ETL workflows to achieve end-to-end automation.

Note:

  • This is an experimental capability; the upstream release number does not establish Cloud availability.
  • This feature is only available when the mc.enable.namespace.schema property is set to true.
  • Supports creating and deleting partitioned and non-partitioned tables.
  • The examples create ordinary partitioned and non-partitioned tables. Other table-property and distribution combinations are outside this walkthrough; establish the supported combination with VeloDB Cloud support.

01 Create and drop a database​

-- Switch to MaxCompute Catalog
SWITCH mc;

-- Create Schema
CREATE DATABASE IF NOT EXISTS mc_schema;

-- Create using fully qualified name
CREATE DATABASE IF NOT EXISTS mc.mc_schema;

-- Drop the empty schema
DROP DATABASE IF EXISTS mc.mc_schema;

Warning:

Remove test tables explicitly before dropping their schema. DROP DATABASE ... FORCE takes a different path that enumerates and drops tables before deleting the schema; use it only when you intend to delete those tables and their data.

02 Create and drop a table​

-- Create non-partitioned table
CREATE TABLE mc_schema.mc_tbl1 (
id INT,
name STRING,
amount DECIMAL(18, 6),
create_time DATETIME
);

-- Create partitioned table
CREATE TABLE mc_schema.mc_tbl2 (
id INT,
val STRING,
ds STRING,
region STRING
)
PARTITION BY (ds, region)();

-- Drop table (will also delete data, including partition data)
DROP TABLE IF EXISTS mc_schema.mc_tbl1;

For more details, please refer to the MaxCompute Catalog documentation.

Common errors​

SymptomResolution
Authentication or permission errorCheck the MaxCompute access key, RAM permissions, project permissions, and whether Storage API is enabled.
Catalog lists tables but reads time outCheck the MaxCompute endpoint and connectivity from the warehouse.
Write or metadata operation is rejectedCheck table type, schema namespace setting, permissions, and the experimental capability's availability with VeloDB Cloud support.

Clean up test resources​

Importing creates warehouse storage and uses compute. Writing back also uses MaxCompute resources. See Billing Overview. Remove only test warehouse and MaxCompute objects after use. Dropping a MaxCompute database or table can delete its data.