All Products
Search
Document Center

MaxCompute:CatalogAPI SDK User Guide

Last Updated:Jun 30, 2026

Manage MaxCompute metadata resources programmatically with the CatalogAPI SDK for Java and Python.

Product version: v0.2.2
SDK repository:aliyun/aliyun-odps-openapi-sdk

Overview

CatalogAPI SDK is an open SDK for managing the MaxCompute data catalog. It provides programmatic access to metadata resources such as Project, Schema, Table, Connection, Role, Taxonomy, DataPolicy, DataScan, and Model.

Features

Core capabilities:

  • Table management

    Create and update internal and external tables, query and delete internal tables, external tables, views, materialized views, and snapshot tables.

  • Connection management

    Manage Connection configurations for accessing external data sources such as OSS and OTS.

  • Permission management

    Implement fine-grained access control through Role and Policy.

  • Data security

    Implement column-level access control through Taxonomy and Policy Tag, and dynamic data masking through DataPolicy.

  • Metadata crawling

    Automatically discover and crawl metadata from external data sources through DataScan.

  • Model management

    Manage metadata for machine learning models with multi-version support.

  • Resource search

    Search various metadata entities within a namespace.

Resource model

CatalogAPI follows a RESTful design style. The core resource hierarchy is as follows:

Namespace (primary account UID)
├── Connection          # External data source connection
├── Role                # Custom role
├── Taxonomy            # Policy tag classification
│   └── PolicyTag       # Policy tag
├── DataPolicy          # Data policy (masking rules)
├── DataScan            # Metadata crawling task
│   └── ScanJob         # Crawling job
Project             # MaxCompute project
    └── Schema          # Namespace (directory)
        ├── Table       # Data table
        │   └── Partition # Partition
        └── Model       # Machine learning model
Note

Namespace ID is the Alibaba Cloud primary account UID.

Quick start

Install the SDK

CatalogAPI SDK is available in Java and Python, hosted on the Alibaba Cloud GitHub repository.

// Add dependency in Maven project
<dependency>
    <groupId>com.aliyun.odps</groupId>
    <artifactId>catalog-api</artifactId>
    <version>0.2.2</version>
</dependency>
pip install pyodps-catalog

Initialize the client

Initialize the CatalogAPI client using an AccessKey pair.

Important

Do not hard-code AccessKey pairs in your code. Use environment variables or configuration files to manage credentials.

import com.aliyun.odps.catalog.Client;
import com.aliyun.odps.models.Config;

public class CatalogDemo {
    public static void main(String[] args) throws Exception {
        // Initialize configuration
        Config config = new Config();
        config.setAccessKeyId(System.getenv("ALIBABACLOUD_ACCESS_KEY_ID"));
        config.setAccessKeySecret(System.getenv("ALIBABACLOUD_ACCESS_KEY_SECRET"));
        // Set the MaxCompute endpoint. The SDK automatically discovers the CatalogAPI endpoint through the routing API.
        // Replace cn-shanghai with your actual region.
        config.setOdpsEndpoint("service.cn-shanghai.maxcompute.aliyun.com");
        
        // Create client
        Client client = new Client(config);
        
        // Use client to call APIs
    }
}
import os
from pyodps_catalog.client import Client
from maxcompute_tea_openapi.models import Config

# Initialize configuration
config = Config(
    access_key_id=os.environ.get('ALIBABACLOUD_ACCESS_KEY_ID'),
    access_key_secret=os.environ.get('ALIBABACLOUD_ACCESS_KEY_SECRET'),
    # Method 1 (recommended): Set odps_endpoint. The SDK automatically discovers the CatalogAPI endpoint through the routing API.
    odps_endpoint='service.cn-shanghai.maxcompute.aliyun.com'
    # Method 2: Directly specify the CatalogAPI endpoint.
    # endpoint='catalogapi.cn-shanghai.maxcompute.aliyun.com'
)

# Create client
client = Client(config)

# Use client to call APIs

Example: List tables

This example lists all tables in a specified schema:

import com.aliyun.odps.catalog.models.ListTablesResponse;
import com.aliyun.odps.catalog.models.Table;

ListTablesResponse response = client.listTables(
    "my_project",    // projectId
    "default",       // schemaName
    100,             // pageSize
    ""               // pageToken. Pass empty string for the first call
);

if (response.getTables() != null) {
    for (Table table : response.getTables()) {
        System.out.println("Table: " + table.getTableName());
    }
}

// If more pages exist, use nextPageToken to continue
String nextToken = response.getNextPageToken();
response = client.list_tables(
    project_id="my_project",
    schema_name="default",
    page_size=100,
    page_token=""
)

if response.tables:
    for table in response.tables:
        print(f"Table: {table.table_name}")

# If more pages exist, use next_page_token to continue
next_token = response.next_page_token

Authentication

Access credentials

CatalogAPI requires an Alibaba Cloud AccessKey pair for authentication. We recommend using a RAM user AccessKey pair and following the least privilege principle.

Permission list

The following table lists the required permissions for each API operation:

Click to expand the full permission list

Resource

Operation

Required permission

Connection

Create

CreateConnection

Connection

List

ListConnection

Connection

Get

GetConnection

Connection

Update

UpdateConnection

Connection

Delete

DeleteConnection

Connection

SetPolicy

SetConnectionPolicy

Connection

GetPolicy

GetConnectionPolicy

Role

Create

CreateRole

Role

List

ListRole

Role

Get

GetRole

Role

Update

UpdateRole

Role

Delete

DeleteRole

Role

SetPolicy

SetRolePolicy

Role

GetPolicy

GetRolePolicy

Taxonomy

Create

CreateTaxonomy

Taxonomy

List

ListTaxonomy

Taxonomy

Get

GetTaxonomy

Taxonomy

Update

UpdateTaxonomy

Taxonomy

Delete

DeleteTaxonomy

Taxonomy

SetPolicy

SetTaxonomyPolicy

Taxonomy

GetPolicy

GetTaxonomyPolicy

PolicyTag

Create

UpdateTaxonomy

PolicyTag

List

GetTaxonomy

PolicyTag

Get

GetTaxonomy

PolicyTag

Update

UpdateTaxonomy

PolicyTag

Delete

UpdateTaxonomy

DataPolicy

Create

CreateDataPolicy

DataPolicy

List

ListDataPolicy

DataPolicy

Get

GetDataPolicy

DataPolicy

Delete

DeleteDataPolicy

DataPolicy

SetPolicy

SetDataPolicyPolicy

DataPolicy

GetPolicy

GetDataPolicyPolicy

Project

Get

ConnectProject

Schema

Create

CreateSchema

Schema

List

ListSchema

Schema

Get

GetSchema

Schema

Update

UpdateSchema

Schema

Delete

DeleteSchema

Schema

SetPolicy

SetSchemaPolicy

Schema

GetPolicy

GetSchemaPolicy

Table

Create

CreateTable

Table

List

List Table

Table

Get

Describe Table

Table

Update

Alter Table

Table

Delete

Drop Table

Table

SetPolicy

SetTablePolicy

Table

GetPolicy

GetTablePolicy

Table

GetDataToken

Select Table+UseConnection

Partition

List

Describe Table

Model

Create

CreateModel

Model

List

List Model

Model

Get

Describe Model

Model

Update

Alter Model

Model

Delete

Drop Model

Model

SetPolicy

SetModelPolicy

Model

GetPolicy

GetModelPolicy

ModelVersion

Create

Alter Model

ModelVersion

Delete

Alter Model

ModelVersion

List

Describe Model

DataScan

Create

CreateDataScan

DataScan

List

ListDataScan

DataScan

Get

GetDataScan

DataScan

Update

UpdateDataScan

DataScan

Delete

DeleteDataScan

DataScan

Trigger

TriggerDataScan

ScanJob

List

ListDataScanJob

Search

Search

SearchNamespace. If the search includes a project condition, SearchProject permission is required for those projects

Policy and Role

CatalogAPI supports Policy-based access control. A Policy consists of a set of Bindings, where each Binding assigns a Role to a set of Members.

  • Policy model

    {
      "etag": "string",
      "bindings": [
        {
          "role": "string",
          "members": ["string"]
        }
      ]
    }
    • etag: used for read-modify-write consistency validation

    • bindings: list of role bindings

      • role: role name

      • members: list of members in the format user:{userId}

  • Set Policy example

    import com.aliyun.odps.catalog.models.*;
    
    // Construct SetPolicyRequest
    Policy policy = new Policy();
    Binding binding = new Binding();
    // The role field requires the full resource path format: namespaces/{namespaceId}/roles/{roleName}
    binding.setRole("namespaces/{namespaceId}/roles/odps.admin");
    binding.setMembers(Arrays.asList("user:123456789"));
    policy.setBindings(Arrays.asList(binding));
    policy.setEtag("fetch_with_get_policy");
    SetPolicyRequest request = new SetPolicyRequest();
    request.setPolicy(policy);
    
    // Set table Policy
    client.setTablePolicy(table, request);

Data models

Common fields

Field

Type

Description

name

string

REST resource full name, globally unique within the domain. The SDK uses the resource name to construct REST request URLs. Typically an output-only field.

Data types

In addition to standard JSON types, the following special data type markers are used:

Data types

Description

enum

Semantic enumeration type, represented as a string in JSON format

int64

64-bit integer, transmitted as a string

Table model

Table is one of the core resources in CatalogAPI.

{
  "etag": "string",
  "name": "string",
  "projectId": "string",
  "schemaName": "string",
  "tableName": "string",
  "type": "enum(TableType)",
  "description": "string",
  "tableSchema": { "object(TableFieldSchema)" },
  "clustering": { "object(Clustering)" },
  "tableConstraints": { "object(TableConstraints)" },
  "partitionDefinition": { "object(PartitionDefinition)" },
  "tableFormatDefinition": { "object(TableFormatDefinition)" },
  "externalDataConfiguration": { "object(ExternalDataConfiguration)" },
  "maxLakeConfiguration": { "object(MaxLakeConfiguration)" },
  "externalCatalogTableOptions": { "object(ExternalCatalogTableOptions)" },
  "expirationOptions": { "object(ExpirationOptions)" },
  "createTime": "string (int64 format)",
  "lastModifiedTime": "string (int64 format)",
  "labels": { "map<string, string>" }
}

Click to expand field details

Field

Type

Required

Description

etag

string

No

Used for read-modify-write consistency validation

name

string

No

Full path of the table, such as projects/{projectId}/schemas/{schemaName}/tables/{tableName}. Output-only

projectId

string

Yes

Project ID to which the table belongs

schemaName

string

Condition

Schema name to which the table belongs. Required in the three-tier model; must not be specified in the two-tier model

tableName

string

Yes

Table name

type

enum(TableType)

No

Table type. Valid values: TABLE (internal table), EXTERNAL (external table), VIEW (view), MATERIALIZED_VIEW (materialized view), SNAPSHOT (snapshot table)

description

string

No

Table description, equivalent to the comment in SQL DDL

tableSchema

TableFieldSchema

No

Column schema definition of the table

clustering

Clustering

No

Cluster attribute definition. Only available for clustered tables

tableConstraints

TableConstraints

No

Primary key constraint definition. Only available for delta tables

partitionDefinition

PartitionDefinition

No

Partition column definitions. Only available for partitioned tables

tableFormatDefinition

TableFormatDefinition

No

Only available for internal tables. Defaults to standard table format

externalDataConfiguration

ExternalDataConfiguration

No

External table configuration. Only applicable to external tables

maxLakeConfiguration

MaxLakeConfiguration

No

Managed lake table configuration

externalCatalogTableOptions

ExternalCatalogTableOptions

No

External catalog information

expirationOptions

ExpirationOptions

No

Expiration configuration for table and partition data

createTime

string (int64)

No

Table creation time in milliseconds. Output-only

lastModifiedTime

string (int64)

No

Table last modification time in milliseconds. Output-only

labels

map<string, string>

No

Labels on the table

TableFieldSchema model

Supported data types (FieldDataType):TINYINT,SMALLINT,INT,BIGINT,BINARY,FLOAT,DOUBLE,DECIMAL,VARCHAR,CHAR,STRING,DATE,DATETIME,TIMESTAMP,TIMESTAMP_NTZ,BOOLEAN,STRUCT,ARRAY,MAP

{
  "fieldName": "string",
  "sqlTypeDefinition": "string",
  "typeCategory": "enum(FieldDataType)",
  "mode": "enum(FieldMode)",
  "fields": [{ "object(TableFieldSchema)" }],
  "description": "string",
  "policyTags": { "object(PolicyTags)" },
  "maxLength": "string (int64 format)",
  "precision": "string (int64 format)",
  "scale": "string (int64 format)",
  "defaultValueExpression": "string"
}

Click to expand field details

Field

Type

Description

fieldName

string

Column name (top-level column) or struct field name. Not present in the table-level tableSchema

sqlTypeDefinition

string

Output-only. String definition representing the column type in SQL DDL statements. Only output for table columns

typeCategory

enum(FieldDataType)

Field type

mode

enum(FieldMode)

REQUIRED (cannot be NULL) or NULLABLE (can be NULL)

fields

TableFieldSchema[]

Sub-fields of a STRUCT type

description

string

Column comment

policyTags

PolicyTags

Optional. Policy tag bound to the column, used for column-level access control and data masking. Absence of this field indicates no policy tag. For nested types, policy tags can only be applied to leaf nodes. Policy tags cannot be applied to partition columns

policyTags.names

string[]

Optional. List of policy tag resource names. Currently, each column supports only one policy tag

maxLength

string (int64)

Maximum length for CHAR/VARCHAR types

precision

string (int64)

Precision for DECIMAL type

scale

string (int64)

Scale for DECIMAL type

defaultValueExpression

string

Optional. Expression string for the default value

Connection model

Connection is used to configure connection information for accessing external data sources such as OSS and OTS.

{
  "name": "string",
  "connectionName": "string",
  "description": "string",
  "creationTime": "string (int64 format)",
  "lastModifiedTime": "string (int64 format)",
  "connectionType": "enum(ConnectionType)",
  "cloudResource": { "object(CloudResourceOptions)" },
  "region": "string"
}

Click to expand field details

Field

Type

Required

Description

name

string

No

Globally unique resource name: namespaces/{namespace_ID}/connections/{connectionName}. Output-only

connectionName

string

Yes

Unique within the namespace. Case-sensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 32] bytes

description

string

No

Optional. Maximum 1 KB

creationTime

string (int64)

No

Connection creation time in milliseconds. Output-only

lastModifiedTime

string (int64)

No

Last modification time in milliseconds

connectionType

enum(ConnectionType)

Yes

Connection type. Valid values: CLOUD_RESOURCE (cloud resource type, such as OSS and OTS)

cloudResource

CloudResourceOptions

Condition

Set only when connectionType is CLOUD_RESOURCE

  • delegatedAccount

    STRING type. Delegated account name, automatically saved as the primary account of the creator upon creation. Output-only.

  • ramRoleArn

    STRING type, required. ARN of the RAM role authorized for MaxCompute service.

region

string

No

Region to which this connection belongs. Output-only

Role model

Role is used to define custom roles.

{
  "name": "string",
  "roleName": "string",
  "description": "string",
  "includedPermissions": ["string"],
  "etag": "string",
  "deleted": false
}

Click to expand field details

Field

Type

Description

name

string

Globally unique resource name: namespaces/{namespace_ID}/roles/{roleName}. Output-only

roleName

string

Unique within the namespace. Case-sensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 255] bytes

description

string

Optional. Maximum 1 KB

includedPermissions

string[]

List of permissions included in the Role

etag

string

Output-only for now. Will be used for read-modify-write consistency in the future

deleted

boolean

Output-only. Indicates whether the item has been deleted

RoleView enum

Enum values

Description

BASIC

Does not return includedPermissions. This is the default

FULL

Returns all fields

Taxonomy model

Taxonomy is used to manage the classification system of policy tags (Policy Tag).

{
  "name": "string",
  "taxonomyName": "string",
  "description": "string",
  "activatedPolicyTypes": ["enum(PolicyType)"],
  "policyTagCount": 0,
  "createTime": "string (int64 format)",
  "lastModifiedTime": "string (int64 format)"
}

Click to expand field details

Field

Type

Description

name

string

Output-only. Format: namespaces/{namespace_ID}/taxonomies/{ID}, where ID is a system-assigned unique ID

taxonomyName

string

Unique within the namespace. Case-sensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 255] bytes

description

string

Optional. Maximum 2000 bytes

activatedPolicyTypes

PolicyType[]

Optional. List of policy types enabled under this Taxonomy. Defaults to POLICY_TYPE_UNSPECIFIED

policyTagCount

integer

Output-only. Number of policy tags in this Taxonomy

createTime

string (int64)

Output-only. Taxonomy creation timestamp in UTC milliseconds

lastModifiedTime

string (int64)

Output-only. Taxonomy last modification timestamp in UTC milliseconds

PolicyType enum

Enum values

Description

POLICY_TYPE_UNSPECIFIED

Unspecified type

FINE_GRAINED_ACCESS_CONTROL

Enable column-level access control

Note

When a taxonomy explicitly specifies FINE_GRAINED_ACCESS_CONTROL, or any policy tag under the taxonomy has a data policy configured, all policy tags under that taxonomy are considered to have column-level access control enabled.

PolicyTag model

PolicyTag is a policy tag attached to a Taxonomy, used to implement column-level access control.

{
  "name": "string",
  "policyTagName": "string",
  "description": "string",
  "parentPolicyTag": "string",
  "childPolicyTags": ["string"]
}

Click to expand field details

Field

Type

Description

name

string

Full path of the PolicyTag: namespaces/{namespace_ID}/taxonomies/{TID}/policyTags/{ID}, where ID is a system-assigned unique ID

policyTagName

string

Unique within the parent Taxonomy. Case-sensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 255] bytes

description

string

Optional. Maximum 2000 bytes

parentPolicyTag

string

Parent node name. Empty indicates the root node. Defaults to empty

childPolicyTags

string[]

Output-only. List of child node names

DataPolicy model

DataPolicy is used to define data masking rules.

{
  "name": "string",
  "dataPolicyName": "string",
  "policyTag": "string",
  "dataPolicyType": "enum(DataPolicyType)",
  "dataMaskingPolicy": { "object(DataMaskingPolicy)" }
}

Click to expand field details

Field

Type

Description

name

string

namespaces/{namespace_ID}/dataPolicies/{dataPolicyName}. Output-only

dataPolicyName

string

User-specified data policy name, unique at the account level

policyTag

string

Full resource name of the policy tag bound to this data policy

dataPolicyType

enum(DataPolicyType)

Currently, only DATA_MASKING_POLICY (column-level data masking) is supported

dataMaskingPolicy

DataMaskingPolicy

Masking rules defined on this data policy

  • DataMaskingPolicy

    Field

    Type

    Description

    predefinedExpression

    enum(PredefinedExpression)

    Predefined masking strategy type

    parameters

    string[]

    Predefined masking strategy parameters

  • Predefined masking strategies (PredefinedExpression)

    Enum values

    Description

    SHA256

    SHA256 hash

    SHA512

    SHA512 hash

    ALWAYS_NULL

    Always returns NULL

    DEFAULT_MASKING_VALUE

    Default masking value

    DATE_YEAR

    Preserves only the year

    POINT_RESERVE

    Preserves the decimal point

    STRING_MASKED_BA

    String masking (forward)

    STRING_UNMASKED_BA

    String unmasked (forward)

    MD5

    MD5 hash

    SM3

    SM3 hash

    REPLACE_RANDOM

    Random replacement

    REPLACE_RANDOM_BA

    Random replacement (forward)

    REPLACE_FIXED

    Fixed value replacement

DataScan model

DataScan is used to configure metadata crawling tasks.

{
  "name": "string",
  "scanName": "string",
  "type": "string",
  "creator": "string",
  "customerId": "string",
  "namespaceId": "string",
  "description": "string",
  "scanId": "string",
  "creationTime": 0,
  "lastModifiedTime": 0,
  "lastTriggeredTime": 0,
  "lastSuccessfulScheduleTime": 0,
  "lastTriggeredBy": "string",
  "schedulingStatus": "string",
  "source": { "object(DataScanSource)" },
  "target": { "object(DataScanTarget)" },
  "properties": { "object(DataScanProperties)" },
  "schedulerMode": "string",
  "schedulerInterval": "string",
  "scheduledCount": 0
}

Click to expand field details

Field

Type

Description

name

string

Globally unique resource name: namespaces/{namespaceID}/dataScans/{dataScanName}

scanName

string

User-specified crawling task name

type

string

Valid values: TABLE_DISCOVERY (table discovery), SCHEMA_DISCOVERY (schema discovery)

creator

string

Creator of the dataScan

customerId

string

Customer ID

namespaceId

string

Namespace to which the dataScan belongs

description

string

User-defined description

scanId

string

System-generated scan ID. Read-only display field

creationTime

int64

Creation time, UTC timestamp

lastModifiedTime

int64

Last modification time, UTC timestamp

lastTriggeredTime

int64

Last trigger time of the crawling task (scheduling start time), UTC timestamp. Defaults to 0 if never triggered

lastSuccessfulScheduleTime

int64

Execution time of the last successful DatascanJob. Defaults to 0

lastTriggeredBy

string

Source that triggered the current scheduling: a specific user or the scheduler

schedulingStatus

string

Scheduling status. Valid values: IDLE / IMMEDIATE / PENDING / SCHEDULING. Initial status is IDLE. Set to IMMEDIATE to execute immediately after creation

source

DataScanSource

Metadata crawling and discovery source

target

DataScanTarget

Parameters controlling how discovery results are written

properties

DataScanProperties

Optional parameters for the crawling task

schedulerMode

string

manual (manually triggered) / periodic (periodic automatic trigger)

schedulerInterval

string

When schedulerMode is periodic, the maximum interval between two crawling tasks. Valid range: [1h-7d]

scheduledCount

int64

Total number of times this dataScan has been scheduled

  • DataScanSource

    Field

    Type

    Description

    location

    string

    Location address. Supports OSS, DLF, and Holo

    connection

    string

    Connection name. Provides the identity and network information required to access the source. Authentication required

    ignores

    string[]

    Paths to ignore. Supports regular expressions

  • DataScanTarget

    Field

    Type

    Description

    project

    string

    Project name to which results are written

    schema

    string

    When dataScan.type is table, the schema to which tables are written

    namePrefix

    string

    Prefix for table/schema names auto-generated by the crawling task, preventing naming conflicts

    properties

    string

    Table/schema attributes that users can specify for the final output

  • DataScanProperties

    Field

    Type

    Description

    formatFilter

    string

    AUTO/PARQUET/ORC/JSON/CSV. Crawl only data with the specified format. If specified, files of other formats are ignored. AUTO enables automatic format detection

    scanMode

    enum

    SAMPLE / TOTAL. Defaults to SAMPLE

    enableStats

    boolean

    Whether statistics are used for query optimization

    options

    string

    Additional optional configurations, such as extra options for CSV format

    pattern

    string

    Partition path recognition pattern, such as {table}/{part1}={value1}/{part2}={value2}

    updatePolicy

    string

    Policy for handling table metadata changes: APPEND_ONLY / OVERWRITE / IGNORE

    syncRemove

    boolean

    Whether to automatically delete tables when removed from the source

    autoCommit

    boolean

    false indicates the crawling task only outputs results without committing DDL

    inventoryLocation

    string

    Specifies the storage location for OSS Inventory logs, used for incremental scanning

Model

Model is used to manage metadata for machine learning models.

{
  "name": "string",
  "modelName": "string",
  "versionName": "string",
  "defaultVersion": "string",
  "createTime": "string",
  "updateTime": "string",
  "versionCreateTime": "string",
  "versionUpdateTime": "string",
  "description": "string",
  "versionDescription": "string",
  "expirationDays": 0,
  "versionExpirationDays": 0,
  "sourceType": "string",
  "modelType": "string",
  "labels": { "map<string, string>" },
  "transform": { "map<string, string>" },
  "path": "string",
  "options": { "map<string, string>" },
  "extraInfo": { "map<string, string>" },
  "versionExtraInfo": { "map<string, string>" },
  "trainingInfo": { "map<string, string>" },
  "inferenceParameters": { "map<string, string>" },
  "featureColumns": { "object(ModelFieldSchema)" },
  "tasks": ["string"]
}

Click to expand field details

Field

Type

Description

name

string

Full path of the model: projects/{projectId}/schemas/{schemaName}/models/{modelName}

modelName

string

Model name, unique within the parent schema. Case-insensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 255] bytes

versionName

string

Version name, unique within the same model. Case-insensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 255] bytes

defaultVersion

string

Default version name of the model

createTime

string

Model creation time in milliseconds

updateTime

string

Model last modification time in milliseconds

versionCreateTime

string

Version creation time in milliseconds

versionUpdateTime

string

Version last modification time in milliseconds

description

string

Model description, maximum 1 KB

versionDescription

string

Version description, maximum 1 KB

expirationDays

integer

Lifecycle in days based on the model last update time

versionExpirationDays

integer

Lifecycle in days based on the version last update time

sourceType

string

Model source type. Cannot be modified after creation

modelType

string

Model type. Cannot be modified after creation

labels

map<string, string>

Model labels

transform

map<string, string>

Version preprocessing information

path

string

Path to the model files of the version

options

map<string, string>

Version parameters

extraInfo

map<string, string>

Additional information about the model

versionExtraInfo

map<string, string>

Additional information about the version

trainingInfo

map<string, string>

Version training information

inferenceParameters

map<string, string>

Version inference parameters

featureColumns

ModelFieldSchema

Column schema definition of the version

tasks

string[]

All task types supported by this version

tasks field constraints

  • For LLM/MLLM models, valid values include one or more of: text-generation, chat, sentence-embedding

  • For BOOSTED_TREE_CLASSIFIER models, valid values are [predict, predict-proba, feature-importance] (in any order)

  • For BOOSTED_TREE_REGRESSOR models, valid values are [predict, feature-importance] (in any order)

Schema model

{
  "name": "string",
  "schemaName": "string",
  "description": "string",
  "type": "enum(SchemaType)",
  "owner": "string",
  "externalSchemaConfiguration": { "object(ExternalSchemaConfiguration)" }
}

Click to expand field details

Field

Type

Description

name

string

Full resource name of the schema: projects/{projectId}/schemas/{schemaName}. Output-only

schemaName

string

Schema name, unique within a project

description

string

Optional. Schema description

type

enum(SchemaType)

Schema type: DEFAULT (default type), EXTERNAL (external, currently not supported)

owner

string

Owner of the schema

externalSchemaConfiguration

ExternalSchemaConfiguration

Optional. Only available for external schemas. Currently not enabled in this version

Project model

{
  "name": "string",
  "projectId": "string",
  "owner": "string",
  "description": "string",
  "createTime": "string (int64 format)",
  "lastModifiedTime": "string (int64 format)",
  "schemaEnabled": "boolean",
  "region": "string"
}

Click to expand field details

Field

Type

Description

name

string

Full resource name of the project: projects/{projectId}. Output-only

projectId

string

Project unique ID

owner

string

Owner of the project

description

string

Project description

createTime

string (int64)

Project creation timestamp in UTC milliseconds

lastModifiedTime

string (int64)

Project last modification timestamp in UTC milliseconds

schemaEnabled

boolean

Whether the three-tier model is enabled for the project

region

string

Region to which the project belongs

Partition model

{
  "spec": "string"
}

Field

Type

Description

spec

string

Partition spec. Example format: bu=tt/ds=20250515

Search model

{
  "name": "string",
  "displayName": "string",
  "type": "string",
  "aspects": { "map<string, string>" },
  "createTime": "string",
  "lastModifiedTime": "string",
  "description": "string"
}

Click to expand field details

Field

Type

Description

name

string

Full path of the entity, such asprojects/{projectId}/schemas/{schemaName}/tables/{tableName}

displayName

string

Entity name

type

string

Entity type, for example, TABLE, RESOURCE, SCHEMA

aspects

map<string, string>

Additional information about the entity

createTime

string

Entity creation time in milliseconds

lastModifiedTime

string

Entity last modification time in milliseconds

description

string

Entity description

API reference

General notes

URL prefix: All API URLs in this document use the following prefix:/api/catalog/v1alpha/.

Important

This prefix is not repeated in individual API descriptions.

Error handling

HTTP status code

Reason

Description

400

InvalidArgument

Invalid request input

403

AccessDenied

No permission to perform this operation

404

NotFound

The object to be operated on does not exist

409

AlreadyExists

The object to be created already exists

429

RateLimitExceeded

Request rate too high. Rate limiting triggered

500

InternalError

Internal server error

Table API

Create table

Create a new table.

  • Method signature

    Table createTable(Table table)
  • Request parameters

    Parameter

    Type

    Required

    Description

    table

    Table

    Yes

    Table object, containing the full table definition

  • Response

    Returns the created Table object.

  • Usage example

    // Construct table
    Table table = new Table();
    table.setProjectId("my_project");
    table.setSchemaName("default");
    table.setTableName("my_table");
    table.setDescription("This is an example table");
    table.setType("TABLE");
    
    // Set table schema
    TableFieldSchema field = new TableFieldSchema();
    field.setFieldName("id");
    field.setTypeCategory("BIGINT");
    field.setMode("REQUIRED");
    
    TableFieldSchema nameField = new TableFieldSchema();
    nameField.setFieldName("name");
    nameField.setTypeCategory("STRING");
    nameField.setMode("NULLABLE");
    
    TableFieldSchema schema = new TableFieldSchema();
    schema.setFields(Arrays.asList(field, nameField));
    table.setTableSchema(schema);
    
    // Create table
    Table createdTable = client.createTable(table);
    System.out.println("Created table: " + createdTable.getName());

Get table

Get detailed information about a specified table.

  • Method signature

    Table getTable(Table table)
  • Request parameters

    Parameter

    Type

    Required

    Description

    table

    Table

    Yes

    Table object containing projectId, schemaName, and tableName

  • Response

    Returns a Table object.

  • Usage example

    Table query = new Table();
    query.setProjectId("my_project");
    query.setSchemaName("default");
    query.setTableName("my_table");
    
    Table result = client.getTable(query);
    System.out.println("Table type: " + result.getType());
    System.out.println("Description: " + result.getDescription());

Update table

Update the attributes of a specified table.

  • Method signature

    Table updateTable(Table table)
  • Request parameters

    Parameter

    Type

    Required

    Description

    table

    Table

    Yes

    Table object containing the updates

  • Response

    Returns the updated Table object.

  • Usage example

    Table table = client.getTable(query);
    table.setDescription("Updated description");
    
    Table updated = client.updateTable(table);

Delete table

Delete a specified table.

  • Method signature

    HttpResponse deleteTable(Table table)
  • Request parameters

    Parameter

    Type

    Required

    Description

    table

    Table

    Yes

    Table object containing projectId, schemaName, and tableName

  • Response

    Returns an empty HttpResponse on success.

  • Usage example

    HttpResponse response = client.deleteTable(table);
    System.out.println("Status code: " + response.getStatusCode());

List tables

List all tables in a specified schema.

  • Method signature

    ListTablesResponse listTables(String projectId, String schemaName, Integer pageSize, String pageToken)
  • Request parameters

    Parameter

    Type

    Required

    Description

    projectId

    string

    Yes

    Project ID

    schemaName

    string

    Yes

    Schema name

    pageSize

    integer

    No

    Page size. Defaults to 100, maximum 1000

    pageToken

    string

    No

    Page token. Defaults to empty

  • Response

    {
      "tables": [Table],
      "nextPageToken": "string"
    }
  • Usage example

    ListTablesResponse response = client.listTables("my_project", "default", 100, "");
    
    // Iterate through all pages
    while (response.getTables() != null && !response.getTables().isEmpty()) {
        for (Table t : response.getTables()) {
            System.out.println(t.getTableName());
        }
        
        if (response.getNextPageToken() == null || response.getNextPageToken().isEmpty()) {
            break;
        }
        response = client.listTables("my_project", "default", 100, response.getNextPageToken());
    }

Set table Policy

Set the access policy of a table.

  • Method signature

    Policy setTablePolicy(Table table, SetPolicyRequest request)
  • Request parameters

    Parameter

    Type

    Required

    Description

    table

    Table

    Yes

    Table object

    request

    SetPolicyRequest

    Yes

    Policy request

  • Response

    Returns the updated Policy object.

Get table Policy

Get the access policy of a table.

  • Method signature

    Policy getTablePolicy(Table table)
  • Request parameters

    Parameter

    Type

    Required

    Description

    table

    Table

    Yes

    Table object

  • Response

    Returns the Policy object of the table.

Get table DataToken

Get a temporary access token for a specified table.

  • Method signature

    DataToken getDataToken(Table table, Integer duration)
  • Request parameters

    Parameter

    Type

    Required

    Description

    table

    Table

    Yes

    Table object

    duration

    integer

    No

    Token validity period (seconds)

  • Response

    {
      "version": "string",
      "type": "string",
      "value": "string",
      "expiration": "string"
    }
  • DataToken field description

    Field

    Type

    Description

    version

    string

    Format version. Currently V1

    type

    string

    Type. Currently only STS is supported

    value

    string

    Token content, base64-encoded

    expiration

    string

    Expiration time

Partition API

List partitions

List all partitions of a specified table.

  • Method signature

    ListPartitionsResponse listPartitions(
        String projectId, 
        String schemaName, 
        String tableName, 
        Integer pageSize, 
        String pageToken,
        String query,
        String view
    )
  • Request parameters

    Parameter

    Type

    Required

    Description

    projectId

    string

    Yes

    Project ID

    schemaName

    string

    Yes

    Schema name

    tableName

    string

    Yes

    Table name

    pageSize

    integer

    No

    Page size. Defaults to 100, maximum 1000

    pageToken

    string

    No

    Page token. Defaults to empty

    query

    string

    No

    Partition search condition, for example, partition_name:part

    view

    string

    No

    Currently, only BASIC is supported

  • Response

    {
      "partitions": [Partition],
      "nextPageToken": "string"
    }

Connection API

Create connection

Create a new external data source connection.

  • Method signature

    Connection createConnection(String namespace, Connection connection)
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID (primary account UID)

    connection

    Connection

    Yes

    Connection object

  • Response

    Returns the created Connection object.

  • Usage example

    // Construct Connection
    Connection conn = new Connection();
    conn.setConnectionName("my_oss_connection");
    conn.setDescription("Connection for accessing OSS");
    conn.setConnectionType("CLOUD_RESOURCE");
    
    CloudResourceOptions options = new CloudResourceOptions();
    options.setRamRoleArn("acs:ram::123456789:role/MaxComputeOSSRole");
    conn.setCloudResource(options);
    
    // Create connection
    Connection created = client.createConnection("123456789", conn);

List connections

List all connections in a specified namespace.

  • Method signature

    ListConnectionsResponse listConnections(String namespace, Integer pageSize, String pageToken)
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    pageSize

    integer

    No

    Page size. Defaults to 100, maximum 1000

    pageToken

    string

    No

    Page token. Defaults to empty

  • Response

    {
      "connections": [Connection],
      "nextPageToken": "string"
    }

Get connection

Get detailed information about a specified connection.

  • Method signature

    Connection getConnection(String namespace, String connectionName)

Update connection

Update the attributes of a specified connection.

  • Method signature

    Connection updateConnection(String namespace, String connectionName, Connection connection, String updateMask)
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    connectionName

    string

    Yes

    Connection name

    connection

    Connection

    Yes

    Connection object containing the updates

    updateMask

    string

    Yes

    Specify the fields to update. Currently, only the description field is supported

  • Response

    Returns the updated Connection object.

  • Usage example

    Connection conn = new Connection();
    conn.setConnectionName("my_oss_connection");
    conn.setDescription("Updated description");
    
    Connection updated = client.updateConnection("123456789", "my_oss_connection", conn, "description");

Delete connection

Delete a specified connection.

  • Method signature

    HttpResponse deleteConnection(String namespace, String connectionName)

Set connection Policy

Set the access policy of a connection.

  • Method signature

    Policy setConnectionPolicy(String namespace, String connectionName, SetPolicyRequest request)

Get connection Policy

Get the access policy of a connection.

  • Method signature

    Policy getConnectionPolicy(String namespace, String connectionName)

Role API

Create role

Create a custom Role.

  • Method signature

    Role createRole(String namespace, Role role)
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    role

    Role

    Yes

    Role object

  • Response

    Returns the created Role object.

  • Usage example

    Role role = new Role();
    role.setRoleName("my_custom_role");
    role.setDescription("Custom role");
    role.setIncludedPermissions(Arrays.asList("odps:CreateTable", "odps:ListTable"));
    
    Role created = client.createRole("123456789", role);

List roles

List all roles in a specified namespace.

  • Method signature

    ListRolesResponse listRoles(
        String namespace, 
        Integer pageSize, 
        String pageToken, 
        String view, 
        Boolean showDeleted
    )
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    pageSize

    integer

    No

    Page size. Defaults to 100, maximum 1000

    pageToken

    string

    No

    Page token. Defaults to empty

    view

    enum(RoleView)

    No

    Defaults to BASIC. When set to FULL, all fields are returned

    showDeleted

    boolean

    No

    Whether to include deleted roles. Defaults to false

  • Response

    {
      "roles": [Role],
      "nextPageToken": "string"
    }

Get role

Get detailed information about a specified role.

  • Method signature

    Role getRole(String namespace, String roleName)
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    roleName

    string

    Yes

    Role name

Update role

Update the attributes of a specified role.

  • Method signature

    Role updateRole(String namespace, String roleName, Role role, String updateMask)
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    roleName

    string

    Yes

    Role name

    role

    Role

    Yes

    Role object containing the updates

    updateMask

    string

    Yes

    Specify the fields to update, such as "description, includedPermissions"

Delete role

Delete a specified custom role.

  • Method signature

    HttpResponse deleteRole(String namespace, String roleName)
Important

After a role is deleted, the following changes take effect immediately:

  • The role can no longer be bound to a Policy.

  • Policies already bound to this role remain in a bound state, but have no effect.

  • The List roles operation does not list deleted roles by default. After a role is deleted, it still counts toward the total limit and remains in a deleted state for seven days. After seven days, the role is permanently deleted, all resource bindings with this role are removed, and it no longer counts toward the total limit.

Set role Policy

Set the access policy of a role.

  • Method signature

    Policy setRolePolicy(String namespace, String roleName, SetPolicyRequest request)

Get role Policy

Get the access policy of a role.

  • Method signature

    Policy getRolePolicy(String namespace, String roleName)

Taxonomy API

Create Taxonomy

Create a new policy tag classification.

  • Method signature

    Taxonomy createTaxonomy(String namespace, Taxonomy taxonomy)
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    taxonomy

    Taxonomy

    Yes

    Taxonomy object

  • Response

    Returns the created Taxonomy object.

  • Usage example

    Taxonomy taxonomy = new Taxonomy();
    taxonomy.setTaxonomyName("sensitive_data");
    taxonomy.setDescription("Sensitive data classification");
    taxonomy.setActivatedPolicyTypes(Arrays.asList("FINE_GRAINED_ACCESS_CONTROL"));
    
    Taxonomy created = client.createTaxonomy("123456789", taxonomy);

List Taxonomy

List all Taxonomies in a specified namespace.

  • Method signature

    ListTaxonomiesResponse listTaxonomies(String namespace, Integer pageSize, String pageToken)

Get Taxonomy

Get detailed information about a specified Taxonomy.

  • Method signature

    Taxonomy getTaxonomy(String namespace, String taxonomyId)

Update Taxonomy

Update the attributes of a specified Taxonomy.

  • Method signature

    Taxonomy updateTaxonomy(String namespace, String taxonomyId, Taxonomy taxonomy, String updateMask)
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    taxonomyId

    string

    Yes

    Taxonomy ID

    taxonomy

    Taxonomy

    Yes

    Taxonomy object containing the updates

    updateMask

    string

    Yes

    Specify the fields to update, such as"description, activatedPolicyTypes"

Delete Taxonomy

Cascade-deletes all policy tags, configured data policies, and column binding relationships under the taxonomy.

  • Method signature

    HttpResponse deleteTaxonomy(String namespace, String taxonomyId)

Set Taxonomy Policy

Set the access policy of a Taxonomy.

  • Method signature

    Policy setTaxonomyPolicy(String namespace, String taxonomyId, SetPolicyRequest request)

Get Taxonomy Policy

Get the access policy of a Taxonomy.

  • Method signature

    Policy getTaxonomyPolicy(String namespace, String taxonomyId)

PolicyTag API

Create PolicyTag

Create a new policy tag under a specified Taxonomy.

  • Method signature

    PolicyTag createPolicyTag(String namespace, String taxonomyId, PolicyTag policyTag)
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    taxonomyId

    string

    Yes

    Taxonomy ID

    policyTag

    PolicyTag

    Yes

    PolicyTag object

  • Response

    Returns the created PolicyTag object.

  • Usage example

    PolicyTag tag = new PolicyTag();
    tag.setPolicyTagName("phone_number");
    tag.setDescription("Phone number masking tag");
    
    PolicyTag created = client.createPolicyTag("123456789", "taxonomy_id_123", tag);

List PolicyTag

List all PolicyTags under a specified Taxonomy.

  • Method signature

    ListPolicyTagsResponse listPolicyTags(
        String namespace, 
        String taxonomyId, 
        Integer pageSize, 
        String pageToken
    )

Get PolicyTag

Get detailed information about a specified PolicyTag.

  • Method signature

    PolicyTag getPolicyTag(String namespace, String taxonomyId, String policyTagId)

Update PolicyTag

Update the attributes of a specified PolicyTag.

  • Method signature

    PolicyTag updatePolicyTag(
        String namespace, 
        String taxonomyId, 
        String policyTagId, 
        PolicyTag policyTag, 
        String updateMask
    )
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    taxonomyId

    string

    Yes

    Taxonomy ID

    policyTagId

    string

    Yes

    PolicyTag ID

    policyTag

    PolicyTag

    Yes

    PolicyTag object containing the updates

    updateMask

    string

    Yes

    Specify the fields to update. Currently, only the description field is supported

Delete PolicyTag

Delete a policy tag and recursively delete: all child nodes of the policy tag, all data policies configured on the policy tag (including child nodes), and column binding relationships of the policy tag on tables (including child nodes).

  • Method signature

    HttpResponse deletePolicyTag(String namespace, String taxonomyId, String policyTagId)

Set PolicyTag Policy

Set the access policy of a PolicyTag.

  • Method signature

    Policy setPolicyTagPolicy(String namespace, String taxonomyId, String policyTagId, SetPolicyRequest request)

Get PolicyTag Policy

Get the access policy of a PolicyTag.

  • Method signature

    Policy getPolicyTagPolicy(String namespace, String taxonomyId, String policyTagId)

DataPolicy API

Create DataPolicy

Create a new data policy (masking rule).

  • Method signature

    DataPolicy createDataPolicy(String namespace, DataPolicy dataPolicy)
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    dataPolicy

    DataPolicy

    Yes

    DataPolicy object

  • Response

    Returns the created DataPolicy object.

  • Usage example

    // Construct masking rule
    DataMaskingPolicy maskingPolicy = new DataMaskingPolicy();
    maskingPolicy.setPredefinedExpression("STRING_MASKED_BA");
    
    DataPolicy policy = new DataPolicy();
    policy.setDataPolicyName("phone_masking");
    policy.setPolicyTag("namespaces/123456789/taxonomies/tid_123/policyTags/ptid_456");
    policy.setDataPolicyType("DATA_MASKING_POLICY");
    policy.setDataMaskingPolicy(maskingPolicy);
    
    DataPolicy created = client.createDataPolicy("123456789", policy);

List DataPolicy

List all DataPolicies in a specified namespace.

  • Method signature

    ListDataPoliciesResponse listDataPolicies(String namespace, Integer pageSize, String pageToken)

Get DataPolicy

Get detailed information about a specified DataPolicy.

  • Method signature

    DataPolicy getDataPolicy(String namespace, String dataPolicyName)

Delete DataPolicy

Delete a specified DataPolicy.

  • Method signature

    HttpResponse deleteDataPolicy(String namespace, String dataPolicyName)

Set DataPolicy Policy

Set the access policy of a DataPolicy.

  • Method signature

    Policy setDataPolicyPolicy(String namespace, String dataPolicyName, SetPolicyRequest request)

Get DataPolicy Policy

Get the access policy of a DataPolicy.

  • Method signature

    Policy getDataPolicyPolicy(String namespace, String dataPolicyName)

DataScan API

Create DataScan

Create a new metadata crawling task.

  • Method signature

    DataScan createDataScan(String namespace, DataScan dataScan)
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespace

    string

    Yes

    Namespace ID

    dataScan

    DataScan

    Yes

    DataScan object

  • Response

    Returns the created DataScan object.

  • Usage example

    // Construct crawling task
    DataScanSource source = new DataScanSource();
    source.setLocation("oss://my-bucket/my-path/");
    source.setConnection("my_oss_connection");
    
    DataScanTarget target = new DataScanTarget();
    target.setProject("my_project");
    target.setSchema("default");
    target.setNamePrefix("auto_");
    
    DataScanProperties properties = new DataScanProperties();
    properties.setFormatFilter("AUTO");
    properties.setScanMode("SAMPLE");
    properties.setAutoCommit(true);
    
    DataScan dataScan = new DataScan();
    dataScan.setScanName("my_oss_scan");
    dataScan.setType("TABLE_DISCOVERY");
    dataScan.setDescription("Crawl OSS metadata");
    dataScan.setSource(source);
    dataScan.setTarget(target);
    dataScan.setProperties(properties);
    dataScan.setSchedulerMode("MANUAL");
    
    DataScan created = client.createDataScan("123456789", dataScan);

List DataScan

List all DataScans in a specified namespace.

  • Method signature

    ListDataScansResponse listDataScans(String namespace, Integer pageSize, String pageToken)

Get DataScan

Get detailed information about a specified DataScan.

  • Method signature

    DataScan getDataScan(String namespace, String dataScanName)

Update DataScan

Update the attributes of a specified DataScan.

  • Method signature

    DataScan updateDataScan(String namespace, DataScan dataScan, String updateMask)

Delete DataScan

Delete a specified DataScan.

  • Method signature

    HttpResponse deleteDataScan(String namespace, String dataScanName)

Trigger DataScan

Manually trigger a DataScan crawling task.

  • Method signature

    HttpResponse triggerDataScan(String namespace, String dataScanName)
  • Usage example

    HttpResponse response = client.triggerDataScan("123456789", "my_oss_scan");
    System.out.println("Triggered: " + response.getStatusCode());

List DataScan jobs

List the crawling job history of a specified DataScan.

  • Method signature

    ListDataScanJobsResponse listDataScanJobs(
        String namespace, 
        String dataScanName, 
        Integer pageSize, 
        String pageToken
    )
  • Response

    {
      "scanJobs": [ScanJob],
      "nextPageToken": "string"
    }
  • ScanJob model

    Field

    Type

    Description

    jobId

    string

    Job ID

    namespaceId

    string

    Namespace to which the job belongs

    dataScanId

    string

    System-generated dataScan ID

    dataScanName

    string

    Name of the parent crawling task

    triggeredBy

    string

    Person who triggered this crawling job. scheduler for scheduled triggers

    startTime

    int64

    Crawling job start time, UTC timestamp

    endTime

    int64

    Crawling job end time, UTC timestamp

    status

    string

    Crawling job status: Created/Running/Terminated/Failed

    statusDetail

    string

    Crawling job status details, such as error messages

    ddl

    string

    DDL information returned by the crawling job that needs to be committed

    stats

    string

    Stats information returned by the crawling job in JSON format

Model API

Create model

Create a new machine learning model.

  • Method signature

    Model createModel(String projectId, String schemaName, Model model)
  • Request parameters

    Parameter

    Type

    Required

    Description

    projectId

    string

    Yes

    Project ID

    schemaName

    string

    Yes

    Schema name

    model

    Model

    Yes

    Model object

  • Response

    Returns the created Model object.

  • Usage example

    Model model = new Model();
    model.setModelName("my_llm_model");
    model.setVersionName("v1");
    model.setDefaultVersion("v1");
    model.setDescription("My large language model");
    model.setSourceType("IMPORT");
    model.setModelType("LLM");
    model.setPath("oss://my-bucket/models/my_llm/");
    model.setTasks(Arrays.asList("text-generation", "chat"));
    
    Model created = client.createModel("my_project", "default", model);

List models

List all models in a specified schema.

  • Method signature

    ListModelsResponse listModels(
        String projectId, 
        String schemaName, 
        Integer pageSize, 
        String pageToken
    )

Get model

Get detailed information about a specified model.

  • Method signature

    Model getModel(String projectId, String schemaName, String modelName, String versionName)
  • Request parameters

    Parameter

    Type

    Required

    Description

    projectId

    string

    Yes

    Project ID

    schemaName

    string

    Yes

    Schema name

    modelName

    string

    Yes

    Model name

    versionName

    string

    No

    Version name. If not specified, the model metadata (without version) is queried

Update model

Update the attributes of a specified model.

  • Method signature

    Model updateModel(
        String projectId, 
        String schemaName, 
        String modelName, 
        Model model, 
        String updateMask, 
        String versionName
    )

Delete model

Delete a specified model (including all versions).

  • Method signature

    HttpResponse deleteModel(String projectId, String schemaName, String modelName)

Create model version

Create a new version for a specified model.

  • Method signature

    Model createModelVersion(String projectId, String schemaName, String modelName, Model model)
  • Usage example

    Model version = new Model();
    version.setModelName("my_llm_model");
    version.setVersionName("v2");
    version.setVersionDescription("Updated model version");
    version.setPath("oss://my-bucket/models/my_llm_v2/");
    version.setTasks(Arrays.asList("text-generation", "chat"));
    
    Model createdVersion = client.createModelVersion("my_project", "default", "my_llm_model", version);

Delete model version

Delete a specified model version.

  • Method signature

    HttpResponse deleteModelVersion(
        String projectId, 
        String schemaName, 
        String modelName, 
        String versionName
    )

List model versions

List all versions of a specified model.

  • Method signature

    ListModelVersionsResponse listModelVersions(
        String projectId, 
        String schemaName, 
        String modelName, 
        Integer pageSize, 
        String pageToken
    )

Set model Policy

Set the access policy of a model.

  • Method signature

    Policy setModelPolicy(String projectId, String schemaName, String modelName, SetPolicyRequest request)

Get model Policy

Get the access policy of a model.

  • Method signature

    Policy getModelPolicy(String projectId, String schemaName, String modelName)

Project API

Get Project

Get detailed information about a specified Project.

  • Method signature

    Project getProject(String projectId)
  • Usage example

    Project project = client.getProject("my_project");
    System.out.println("Project owner: " + project.getOwner());
    System.out.println("Schema enabled: " + project.getSchemaEnabled());
    System.out.println("Region: " + project.getRegion());

Schema API

Create Schema

Create a new Schema in a specified Project.

  • Method signature

    Schema createSchema(String projectId, Schema schema)
  • Request parameters

    Parameter

    Type

    Required

    Description

    projectId

    string

    Yes

    Project ID

    schema

    Schema

    Yes

    Schema object

  • Response

    Returns the created Schema object.

  • Usage example

    Schema schema = new Schema();
    schema.setSchemaName("my_schema");
    schema.setDescription("My custom schema");
    
    Schema created = client.createSchema("my_project", schema);

List Schema

List all Schemas in a specified Project.

  • Method signature

    ListSchemasResponse listSchemas(String projectId, Integer pageSize, String pageToken)

Get Schema

Get detailed information about a specified Schema.

  • Method signature

    Schema getSchema(String projectId, String schemaName)

Update Schema

Update the attributes of a specified Schema.

  • Method signature

    Schema updateSchema(String projectId, String schemaName, String updateMask, Schema schema)
  • Request parameters

    Parameter

    Type

    Required

    Description

    projectId

    string

    Yes

    Project ID

    schemaName

    string

    Yes

    Schema name

    updateMask

    string

    Yes

    Specify the fields to update. Currently, only the description and owner fields are supported, and only one field can be updated at a time

    schema

    Schema

    Yes

    Schema object containing the updates

Delete Schema

Delete a specified Schema.

  • Method signature

    HttpResponse deleteSchema(String projectId, String schemaName)

Set Schema Policy

Set the access policy of a Schema.

  • Method signature

    Policy setSchemaPolicy(String projectId, String schemaName, SetPolicyRequest request)

Get Schema Policy

Get the access policy of a Schema.

  • Method signature

    Policy getSchemaPolicy(String projectId, String schemaName)

Search API

Search entities

Search various entities within a specified namespace.

  • Method signature

    SearchResponse search(
        String namespaceId, 
        String query, 
        Integer pageSize, 
        String pageToken, 
        String orderBy
    )
  • Request parameters

    Parameter

    Type

    Required

    Description

    namespaceId

    string

    Yes

    Primary account ID. Search is performed within the scope of this primary account

    query

    string

    Yes

    Search query string composed of one or more query conditions separated by commas

    pageSize

    integer

    No

    Number of results per page. Must be > 0, maximum 100

    pageToken

    string

    No

    Page token

    orderBy

    string

    No

    Result sort order

  • Query syntax

    • List of query conditions:

      Query condition

      Description

      name:foo

      Match foo as a substring against the entity name

      description:bar

      Match bar as a substring against the entity description

      type=TABLE

      Required. Match entities of a specific type. Currently supports TABLE, RESOURCE, SCHEMA

      project=proj

      Search entities under a single specified project only. The caller must have SearchProject permission for the project

      project=(proj1|proj2|proj3)

      Search entities across multiple projects (up to 512). The caller must have SearchProject permission for all specified projects

      region=region_id

      Search entities under projects in a specified region

      • project=proj and project=(proj1|proj2|proj3) cannot be used together

      • region=region_id cannot be used together with the project query condition

  • Sort order (orderBy)

    Valid values

    Description

    default

    Internal storage order (default)

    create_time asc

    Creation time ascending

    create_time desc

    Creation time descending

    last_modified_time asc

    Last modification time ascending

    last_modified_time desc

    Last modification time descending

  • Response

    {
      "entries": [SearchResultEntry],
      "nextPageToken": "string"
    }
  • Usage example

    // Search all tables in a specified project
    SearchResponse response = client.search(
        "123456789",                            // namespaceId
        "type=TABLE,project=my_project",        // query
        50,                                     // pageSize
        "",                                     // pageToken
        "last_modified_time desc"               // orderBy
    );
    
    if (response.getEntries() != null) {
        for (SearchResultEntry entry : response.getEntries()) {
            System.out.println("Name: " + entry.getDisplayName());
            System.out.println("Type: " + entry.getType());
            System.out.println("Path: " + entry.getName());
        }
    }

Usage limits

Rate limits

Rate limits are enforced at the primary account level. Each method has its own rate limit, which varies by request category.

Limit

Value

Get and GetPolicy methods

1500 requests / 15 seconds

List, Create, Update, Delete, and SetPolicy methods

150 requests / 15 seconds

GetProject, ListTables, ListPartitions view=StorageDetail/FULL

15 requests / 15 seconds

Capacity limits

Limit

Value

Number of custom roles per primary account

300

Number of permissions per Role

3000

Number of principals per Allow Policy

1500

Total size of a single custom Role (including description, roleName, etc.)

64KB

Policy Tag limits

Limit

Value

Number of Policy Tags bound to a single column in a single table

1

Number of Taxonomies per account

40

Number of Policy Tags per Taxonomy

100

Depth of a Policy Tag Tree

5

Number of Data Policies per Tag

8

Pagination limits

Parameter

Default value

Maximum value

pageSize

100

1000 (100 for some APIs)

Naming conventions

Connection naming conventions

Field

Convention

connectionName

Unique within the namespace. Case-sensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 32] bytes

Role naming conventions

Field

Convention

roleName

Unique within the namespace. Case-sensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 255] bytes

Taxonomy naming conventions

Field

Convention

taxonomyName

Unique within the namespace. Case-sensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 255] bytes

PolicyTag naming conventions

Field

Convention

policyTagName

Unique within the parent Taxonomy. Case-sensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 255] bytes

DataPolicy naming conventions

Field

Convention

dataPolicyName

Unique at the account level

Model naming conventions

Field

Convention

modelName

Unique within the parent schema. Case-insensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 255] bytes

versionName

Unique within the same model. Case-insensitive. Valid characters: [a-z][A-Z][0-9]_. Length range: [3, 255] bytes

FAQ

What is a Namespace ID?

Namespace ID is the Alibaba Cloud primary account UID. When calling namespace-level APIs such as Connection, Role, Taxonomy, DataPolicy, and DataScan, the primary account UID must be passed as the namespace parameter.

What is the three-tier model?

MaxCompute supports two metadata organization methods:

  • Two-tier model: Project → Table (traditional method)

  • Three-tier model: Project → Schema → Table (new method)

Through Project.schemaEnabled field to determine whether the three-tier model is enabled for a Project. If the three-tier model is enabled, the schemaName parameter must be specified when calling Table APIs.

How to implement column-level access control using Policy Tag?

Complete workflow for column-level access control:

  1. Create a Taxonomy with activatedPolicyTypes set to FINE_GRAINED_ACCESS_CONTROL.

  2. Create PolicyTags under the Taxonomy (supports a tree-like hierarchical structure).

  3. Bind a PolicyTag to a specified column in the table column schema.

  4. Create a DataPolicy for the PolicyTag (define masking rules, optional).

  5. Use Policy to control which users can access columns bound with PolicyTag.

How to check DataScan crawling results?

After a DataScan crawling task runs, a ScanJob is generated. Job history can be viewed through the listDataScanJobs API. Each ScanJob contains:

  • status: job status (Created/Running/Terminated/Failed)

  • ddl: DDL information returned by crawling that needs to be committed

  • stats: statistics information returned by crawling (JSON format)

Are policy tags restored when restoring deleted tables with the RESTORE command?

No. Policy tags that were applied to the table before deletion are not restored with the table. After restoration, policy tags must be reapplied to the table columns.

How to handle pagination?

Most List APIs return a nextPageToken field. If this field is not empty, more pages are available. Pass the nextPageToken as the pageToken parameter in the next request to retrieve the next page of data.

Appendix

SDK version history

Version

Release date

Description

v0.2.2

Current version

Glossary

Term

Description

Namespace

Namespace, corresponding to the Alibaba Cloud primary account UID

Project

MaxCompute project

Schema

Namespace (directory) for the three-tier model

Table

Data table

Connection

External data source connection

Role

Custom role

Taxonomy

Policy tag classification system

PolicyTag

Policy tag for implementing column-level access control

DataPolicy

Data policy for defining data masking rules

DataScan

Metadata crawling task

Model

Machine learning model metadata

Policy

Access policy, consisting of a set of Bindings

Binding

Bind a role to a set of members