All Products
Search
Document Center

MaxCompute:MaxCompute CLI

Last Updated:Jun 25, 2026

MaxCompute CLI (maxc) is a command-line tool invoked through the Alibaba Cloud CLI as aliyun maxc. All commands produce structured JSON output for script automation and AI Agent integration.

Installation and verification

maxc is distributed through the Alibaba Cloud CLI. To use maxc, you must install or update the Alibaba Cloud CLI.

  • Supported operating systems

    Operating system

    Supported versions

    Supported architectures

    Linux

    CentOS 8+, RHEL 8+, Ubuntu 16.04+, Debian 9+, and other major distributions. CentOS 7 has reached EOL and is not recommended.

    x86_64 (64-bit), ARM64

    macOS

    macOS 11 (Big Sur) or later

    Intel and Apple silicon (Universal binary)

    Windows

    Windows 10 and later (64-bit)

    x86_64 only. 32-bit and ARM64 are not supported.

  • Select the tab for your operating system and follow the installation steps. Multiple methods are available — choose one.

    Linux

    Install using a Bash script (Recommended)

    The following options are supported:

    • Install the latest version

      If you do not specify a version, the script automatically installs the latest version.

      /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)"
    • Install a previous version

      Use the -V option to specify the version to install. To view available previous versions, go to the GitHub Releases page.

      /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)" -- -V 3.3.18

    Install from a TGZ package (.tar.gz)

    1. Download the installation package.

      • Download the latest version:

        Note

        Run uname -m to check your Linux system architecture. If the terminal output is arm64 or aarch64, your system has an ARM64 architecture. Other outputs indicate an AMD64 architecture.

        • For AMD64 systems:

          curl https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz -o aliyun-cli-linux-latest.tgz
        • For ARM64 systems:

          curl https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-arm64.tgz -o aliyun-cli-linux-latest.tgz
      • Download a previous version: Go to the GitHub Releases page to download installation packages for previous versions.

        The file name format for Linux installation packages is aliyun-cli-linux-<version>-<architecture>.tgz. Replace <version> with the target version number, such as 3.3.18, and <architecture> with `amd64` or `arm64`.

    2. Decompress the installation package to obtain the aliyun executable file.

      tar xzvf aliyun-cli-linux-latest.tgz
    3. Move the executable file to the /usr/local/bin directory. This lets you run the aliyun command from any path.

      sudo mv ./aliyun /usr/local/bin/

    macOS

    Install using Homebrew (Recommended)

    Note

    Before you continue, make sure that you have installed and configured Homebrew.

    Install the latest version of the Alibaba Cloud CLI:

    brew install aliyun-cli

    Install using the graphical interface (PKG)

    Double-click the package to install — no command-line tool required.

    1. Download the installation package.

      • Download the latest version: Open the download link https://aliyuncli.alicdn.com/aliyun-cli-latest.pkg in your browser to download the latest installation package.

      • Download a previous version: Go to the GitHub Releases page to view and download installation packages for previous versions.

        The file name format for macOS PKG (macOS Installer Package, .pkg) installation packages is aliyun-cli-<version>.pkg.

    2. Double-click the downloaded installation package and follow the instructions to complete the installation.

    Install using a Bash script

    The installation commands are the same as those for Linux. For more information about parameter descriptions, see the "Install using a Bash script" section for Linux.

    • Install the latest version

      /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)"
    • Installing previous versions

      /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)" -- -V 3.3.5

    Install from a TGZ package (.tar.gz)

    1. Download the installation package.

      • Download the latest version:

        curl https://aliyuncli.alicdn.com/aliyun-cli-macosx-latest-universal.tgz -o aliyun-cli-macosx-latest-universal.tgz
      • Download a previous version: Go to the GitHub Releases page to download installation packages for previous versions.

        The file name format for macOS installation packages is aliyun-cli-macosx-<version>-universal.tgz.

    2. Decompress the installation package to obtain the aliyun executable file.

      tar xzvf aliyun-cli-macosx-latest-universal.tgz
    3. Move the executable file to the /usr/local/bin directory. This lets you run the aliyun command from any path.

      sudo mv ./aliyun /usr/local/bin/

    Windows

    Important

    The Alibaba Cloud CLI is available only for Windows AMD64 systems. It does not support 32-bit or ARM64 architectures.

    Install using the graphical user interface (GUI)

    Download and decompress the installation package

    1. Download the installation package.

    2. Extract aliyun.exe from the installation package to a directory such as C:\AliyunCLI.

      Note
      • This file must be run from a command-line terminal. Double-clicking the file does not work.

      • Remember this installation path. You will need it when you configure the PATH environment variable.

    Configure the PATH environment variable

    1. Press the Windows + S keys to open the search interface, and then enter the keyword "environment variables".

    2. In the search results, click Edit the environment variables for your account to open the Environment Variables settings.

    3. In the User variables section, select the environment variable with the key Path and click Edit.

    4. In the edit window, click New and enter the installation directory path for the Alibaba Cloud CLI. For example, C:\ExampleDir. Replace this with your actual installation directory path.

      image

    5. Click OK in all open dialog boxes to save the changes.

    6. Restart your terminal session for the changes to take effect.

    Install using a PowerShell script

    1. Create a new script file named Install-CLI-Windows.ps1. You can run New-Item Install-CLI-Windows.ps1 in PowerShell to create the file, or create a new text document in File Explorer and rename it.

    2. Copy the following code and save it to the script file.

      Script example

      # Install-CLI-Windows.ps1
      # Purpose: Install Alibaba Cloud CLI on Windows AMD64 systems.
      # Supports custom version and install directory. Only modifies User-level and Process-level PATH.
      
      [CmdletBinding()]
      param (
          [string]$Version = "latest",
          [string]$InstallDir = "$env:LOCALAPPDATA",
          [switch]$Help
      )
      
      function Show-Usage {
          Write-Output @"
      
            Alibaba Cloud Command Line Interface Installer
      
          -Help                 Display this help and exit
      
          -Version VERSION      Custom CLI version. Default is 'latest'
      
          -InstallDir PATH      Custom installation directory. Default is:
                                $InstallDir\AliyunCLI
      
      "@
      }
      
      function Write-ErrorExit {
          param([string]$Message)
          Write-Error $Message
          exit 1
      }
      
      if ($PSBoundParameters['Help']) {
          Show-Usage
          exit 0
      }
      
      Write-Output @"
      ..............888888888888888888888 ........=8888888888888888888D=..............
      ...........88888888888888888888888 ..........D8888888888888888888888I...........
      .........,8888888888888ZI: ...........................=Z88D8888888888D..........
      .........+88888888 ..........................................88888888D..........
      .........+88888888 .......Welcome to use Alibaba Cloud.......O8888888D..........
      .........+88888888 ............. ************* ..............O8888888D..........
      .........+88888888 .... Command Line Interface(Reloaded) ....O8888888D..........
      .........+88888888...........................................88888888D..........
      ..........D888888888888DO+. ..........................?ND888888888888D..........
      ...........O8888888888888888888888...........D8888888888888888888888=...........
      ............ .:D8888888888888888888.........78888888888888888888O ..............
      "@
      
      $OSArchitecture = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture
      
      $ProcessorArchitecture = [int](Get-WmiObject -Class Win32_Processor).Architecture
      
      if (-not ($OSArchitecture -match "64") -or $ProcessorArchitecture -ne 9) {
          Write-ErrorExit "Alibaba Cloud CLI only supports Windows AMD64 systems. Please run on a compatible system."
      }
      
      $DownloadUrl = "https://aliyuncli.alicdn.com/aliyun-cli-windows-$Version-amd64.zip"
      
      $tempPath = $env:TEMP
      $randomName = -join ((65..90) + (97..122) + (48..57) | Get-Random -Count 8)
      $DownloadDir = Join-Path -Path $tempPath -ChildPath $randomName
      New-Item -ItemType Directory -Path $DownloadDir | Out-Null
      
      try {
          $InstallDir = Join-Path $InstallDir "AliyunCLI"
          if (-not (Test-Path $InstallDir)) {
              New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
          }
      
          $ZipPath = Join-Path $DownloadDir "aliyun-cli.zip"
          Start-BitsTransfer -Source $DownloadUrl -Destination $ZipPath
      
          Expand-Archive -Path $ZipPath -DestinationPath $DownloadDir -Force
      
          Move-Item -Path "$DownloadDir\aliyun.exe" -Destination "$InstallDir\" -Force
      
          $Key = 'HKCU:\Environment'
          $CurrentPath = (Get-ItemProperty -Path $Key -Name PATH).PATH
      
          if ([string]::IsNullOrEmpty($CurrentPath)) {
              $NewPath = $InstallDir
          } else {
              if ($CurrentPath -notlike "*$InstallDir*") {
                  $NewPath = "$CurrentPath;$InstallDir"
              } else {
                  $NewPath = $CurrentPath
              }
          }
      
          if ($NewPath -ne $CurrentPath) {
              Set-ItemProperty -Path $Key -Name PATH -Value $NewPath
              $env:PATH += ";$InstallDir"
          }
      } catch {
          Write-ErrorExit "Failed to install Alibaba Cloud CLI: $_"
      } finally {
          Remove-Item -Path $DownloadDir -Recurse -Force | Out-Null
      }
    3. Run the script file to install the Alibaba Cloud CLI as shown in the following examples.

      Note

      The example script path is C:\Example\Install-CLI-Windows.ps1. Before you run the command, replace the script path with the actual location.

      • If you do not specify a version, the script automatically installs the latest version. The default installation path is C:\Users\<USERNAME>\AppData\Local\AliyunCLI.

        powershell.exe -ExecutionPolicy Bypass -File C:\Example\Install-CLI-Windows.ps1
      • Use the -Version and -InstallDir options to specify the installation version and directory. To view available previous versions, go to the GitHub Releases page.

        powershell.exe -ExecutionPolicy Bypass -File C:\Example\Install-CLI-Windows.ps1 -Version 3.3.15 -InstallDir "C:\ExampleDir\AliyunCLI"
  • Verify the installation

    Run the following command to verify the installation.

    aliyun maxc --version

    If the version number appears, the installation succeeded. If an error occurs, check the CLI version. For more information, see Install or update the Alibaba Cloud CLI.

Authentication

aliyun maxc reuses the Alibaba Cloud CLI credential system. All authentication methods configured with aliyun configure (except OAuth) work directly — maxc inherits the current profile's credentials.

# Configure authentication using the Alibaba Cloud CLI (if you have not already done so)
aliyun configure --mode AK

# Verify that maxc can access MaxCompute
aliyun maxc auth whoami --json

For more information about authentication methods, see Configure and manage identity credentials.

Configure a MaxCompute project

When you use maxc for the first time, you must specify the MaxCompute project and endpoint:

aliyun maxc auth login \
  --endpoint http://service.cn-hangzhou.maxcompute.aliyun.com/api

If you omit --project, an interactive project selector appears. For continuous integration (CI) scenarios, you must explicitly specify the project:

aliyun maxc auth login \
  --project my_project_dev \
  --endpoint http://service.cn-hangzhou.maxcompute.aliyun.com/api \
  --no-picker

The MaxCompute project configuration is saved in ~/.maxc/config.yaml.

View and verify

# View the current identity and project
aliyun maxc auth whoami --json

# Check permissions for a specific table
aliyun maxc auth can-i --table my_table --operation SELECT --json

Quick Start

# 1. Configure the project (authentication is already completed with aliyun configure)
aliyun maxc auth login \
  --endpoint http://service.cn-hangzhou.maxcompute.aliyun.com/api

# 2. Browse tables
aliyun maxc meta list-tables --json
aliyun maxc meta describe my_table --json

# 3. Run a query
aliyun maxc query "SELECT * FROM my_table LIMIT 10" --json

# 4. Estimate the cost
aliyun maxc query cost "SELECT * FROM my_table" --json

# 5. Sample data
aliyun maxc data sample my_table --rows 5 --json

Global options

The following options can be placed anywhere in the command line and apply to all commands:

Option

Description

--json

Outputs in JSON Envelope format (equivalent to --format json)

--format

Output format: json, table, csv, ndjson, markdown, or brief

--config

Specifies the configuration file path

--project

The target MaxCompute project (temporarily overwrites session settings)

--schema

The target schema (temporarily overwrites session settings)

Use --project and --schema to temporarily access other projects or schemas without changing the session configuration. Table names also support the schema.table format.

Command reference

SQL query (Query)

  • query modes

    Three modes are available, selected by the first keyword:

    aliyun maxc query <sql>             # Run a query (default)
    aliyun maxc query cost <sql>        # Estimate the cost
    aliyun maxc query explain <sql>     # View the execution plan

    The default mode is read-only — DDL and DML statements are blocked on the client side. Use --force to bypass this restriction.

    aliyun maxc query "SELECT * FROM my_table LIMIT 10" --json
  • Parameter description

    Parameter

    Description

    Default value

    <sql>

    SQL text

    --file

    Reads the SQL from a file

    --stdin

    Reads the SQL from standard input

    --max-rows

    The maximum number of rows to return

    100

    --page-size

    The page size

    --cursor

    The pagination cursor (the return value from the last call)

    --wait

    The number of seconds to wait for synchronization. If a timeout occurs, the job_id is returned.

    10

    --dry-run

    Displays only the query plan without running it

    --cost-check

    Aborts the query if the estimated cost exceeds the threshold (in CUs)

    --output

    Writes the result to a file

    --output-format

    The output file format: table, json, csv, or ndjson

    --idempotency-key

    The deduplication key, used for idempotent retries

    --retry-on

    A comma-separated list of retryable error codes

    --max-retries

    The maximum number of retries

    0

    --retry-backoff

    The backoff policy: fixed or exponential

    fixed

    --force

    Bypasses the read-only mode and allows DDL/DML statements

  • --wait behavior

    • --wait 10 (Default): Polls synchronously for 10 seconds. If the job is complete, the result is returned. If a timeout occurs, the job_id is returned.

    • --wait 0: Submits the job and immediately returns the job_id.

    • --wait 300: Waits for a maximum of 5 minutes.

    After a timeout, you can use job wait <job_id> to continue waiting.

  • Examples

    # Run from a file
    aliyun maxc query --file my_query.sql --json
    
    # Cost protection: Automatically aborts if the estimated cost exceeds 100 CUs
    aliyun maxc query "SELECT * FROM orders" --cost-check 100 --json
    
    # Paging
    aliyun maxc query "SELECT * FROM orders" --page-size 50 --json
    aliyun maxc query "SELECT * FROM orders" --page-size 50 --cursor <next_cursor> --json
    
    # Write the result to a CSV file
    aliyun maxc query "SELECT * FROM orders LIMIT 1000" --output result.csv --output-format csv --json
    
    # Idempotent retry
    aliyun maxc query "INSERT INTO target SELECT * FROM source WHERE ds='20260601'" \
      --force --idempotency-key "daily-etl-20260601" \
      --retry-on "QUOTA_EXCEEDED" --max-retries 3 --retry-backoff exponential --json

Job management (Job)

Manages the lifecycle of asynchronous SQL jobs.

job submit

Submits an SQL job and immediately returns the job_id.

aliyun maxc job submit "SELECT * FROM large_table" --json

Parameter

Description

Default value

<sql>

SQL text

--file

Reads the SQL from a file

--stdin

Reads the SQL from standard input

--max-rows

The maximum number of rows to return

100

--cost-check

The cost threshold (in CUs)

--idempotency-key

The deduplication key

--force

Allows DDL/DML statements

job status / wait / result / cancel / diagnose

aliyun maxc job status <job_id> --json       # Query the status
aliyun maxc job wait <job_id> --json         # Wait for completion and return the result
aliyun maxc job result <job_id> --json       # Get the result of a completed job
aliyun maxc job cancel <job_id> --json       # Cancel a running job
aliyun maxc job diagnose <job_id> --json     # Diagnose the cause of a failure
  • Additional parameters for job wait

    Parameter

    Description

    Default value

    --timeout

    Timeout in seconds

    300

    --stream

    Streams progress output in NDJSON format

  • Additional parameters for job result

    Parameter

    Description

    Default value

    --max-rows

    The maximum number of rows to return

    100

    --cursor

    The pagination cursor

job list

aliyun maxc job list --json                  # Lists recent jobs (20 by default)
aliyun maxc job list --limit 50 --json       # Specify the number of jobs

Complete flow for an asynchronous query

# 1. Submit
JOB_ID=$(aliyun maxc query "SELECT * FROM large_table" --wait 0 --json \
  | jq -r '.metadata.job_id')

# 2. Wait
aliyun maxc job wait "$JOB_ID" --timeout 600 --json

# 3. Get the result (supports paging)
aliyun maxc job result "$JOB_ID" --max-rows 1000 --json

Metadata browsing (Meta)

Table operations

# List tables
aliyun maxc meta list-tables --json

# View the table schema (--full displays the complete column list; summary mode is the default)
aliyun maxc meta describe my_table --json
aliyun maxc meta describe my_table --full --json

# Search for tables
aliyun maxc meta search "order" --json

# Search for columns
aliyun maxc meta search-columns "user_id" --json

list-tables and search support paging with --limit and --cursor. By default, search returns 20 items.

Partition operations

# List partitions (up to 100 by default)
aliyun maxc meta partitions my_table --json
aliyun maxc meta partitions my_table --limit 500 --json

# View the latest partition
aliyun maxc meta latest-partition my_table --json

# View data freshness
aliyun maxc meta freshness my_table --json

Projects and schemas

# List accessible projects
aliyun maxc meta list-projects --json

# List schemas in a project
aliyun maxc meta list-schemas --json

Semantic metadata

Provides business semantic information about tables for AI Agents. For more information, see AI Agent integration.

# Set semantic information
aliyun maxc meta semantic set my_table \
  --desc "Order details table" \
  --use-cases "Analyze daily order volume" "Calculate user repurchase rate" \
  --json

# Get semantic information
aliyun maxc meta semantic get my_table --json

# List tables that are missing semantic information
aliyun maxc meta semantic list-missing --json

semantic set also supports --sample-questions, --column-semantics (JSON), --relations (JSON), and --stats (JSON).

Data operations (Data)

Data sample

Samples data from a table. For partitioned tables, the latest partition is selected by default. Views are not supported.

aliyun maxc data sample my_table --json
aliyun maxc data sample my_table --rows 20 --partition "ds=20260601" --columns "user_id,amount" --json

Parameter

Description

Default value

<table_name>

The table name

--rows

The number of rows to sample

5

--partition

The partition specification

Latest is auto-selected

--columns

The columns to include (comma-separated)

All

Data profile

Analyzes column statistics such as null percentages, unique value counts, and min/max values. Results are heuristic, based on a 20-row sample.

aliyun maxc data profile my_table --json
aliyun maxc data profile my_table --partition "ds=20260601" --json
aliyun maxc data profile <table_name> --json

Data upload

Uploads a local CSV or TSV file to a table. For partitioned tables, --partition is required. Views and complex types (array, map, struct) are not supported.

aliyun maxc data upload my_table --file data.csv --json
aliyun maxc data upload my_table --file data.csv --partition "ds=20260601" --overwrite --json

Parameter

Description

Default value

<table_name>

The destination table name

--file

The local file path (required)

--partition

The partition specification (required for partitioned tables)

--overwrite

Uses INSERT OVERWRITE semantics

--delimiter

The field separator

,

--no-header

Indicates that the first row is data, not a header

--null-marker

The NULL marker

\N

--block-size

The number of rows to upload per batch

10000

Data download

Downloads table data to a local CSV or TSV file. For partitioned tables, --partition is required. Views are not supported.

aliyun maxc data download my_table --output data.csv --json
aliyun maxc data download my_table --output data.csv --partition "ds=20260601" --limit 100000 --json

Parameter

Description

Default value

<table_name>

The source table name

--output

The output file path (required)

--partition

The partition specification (required for partitioned tables)

--columns

The columns to include (comma-separated)

All

--limit

The maximum number of rows to download

Unlimited

--delimiter

The field separator

,

--no-header

Does not write a header row

--null-marker

The NULL output marker

Empty string

Session management (Session)

Manages the default project and schema for the current session. These are local operations that do not require a backend connection.

# Set the default project (specify at least --project or --schema)
aliyun maxc session set --project my_project_dev --json

# Set the default schema
aliyun maxc session set --schema my_schema --json

# View the current session
aliyun maxc session show --json

# Clear session settings
aliyun maxc session unset --json

To temporarily switch projects without modifying the session configuration, use the global --project parameter:

aliyun maxc meta list-tables --project other_project --json
aliyun maxc query "SELECT * FROM t LIMIT 5" --project other_project --json

Output format

JSON Envelope

Adding --json to any command produces a unified JSON Envelope (v2.0):

{
  "version": "2.0",
  "command": "query",
  "status": "success",
  "data": { ... },
  "metadata": { ... },
  "error": null,
  "agent_hints": null
}

Field

Type

Description

version

string

Fixed at "2.0"

command

string

The command that was run, such as "query" or "meta describe"

status

string

"success" or "failure"

data

object

The business data returned by the command

metadata

object

Execution metadata (such as project name, time consumed, and job_id)

error

object/null

Details of the error if the command failed

agent_hints

object/null

Recommended next actions for the AI Agent

Data field

The structure of the data field varies based on the command:

Command

Top-level keys in data

query / job wait / job result

result (contains rows, schema, row_count, returned_rows), pagination

query cost / query explain

analysis

meta list-tables

tables, pagination

meta describe

table

meta search / meta search-columns

search (contains keyword, matches), pagination

meta partitions

table, partitions

meta latest-partition

partition

meta freshness

freshness

data sample

sample

data profile

profile

job list

jobs, pagination

job status / job cancel

job

job diagnose

diagnosis

auth whoami

identity

auth login

identity, persistence

auth can-i

authorization

error field

If a command fails, the error field contains the following fields:

{
  "code": "TABLE_NOT_FOUND",
  "message": "Table 'orders' does not exist in project 'my_project'",
  "suggestion": "Use 'aliyun maxc meta search orders --json' to find similar tables",
  "recoverable": false
}

Field

Description

code

Error code (see the table below)

message

Error description

suggestion

Recommended fix (optional)

recoverable

Indicates whether the operation can be retried

instance_id

The ODPS instance ID (only for query errors, optional)

logview

The LogView link (only for query errors, optional)

context

Structured context (optional)

Error codes

Error code

Description

Retryable

EXECUTION_FAILED

Execution failed

Yes

PERMISSION_DENIED

Permission denied

No

QUOTA_EXCEEDED

Quota exceeded

Yes

SQL_ERROR

SQL syntax or execution error

No

COST_LIMIT_EXCEEDED

Cost limit exceeded

No

NOT_FOUND

Resource not found

No

TABLE_NOT_FOUND

Table not found

No

SCHEMA_NOT_FOUND

Schema not found

No

COLUMN_NOT_FOUND

Column not found

No

VALIDATION_ERROR

Input validation failed

No

BACKEND_CONNECTION_ERROR

Cannot connect to the backend

Yes

JOB_TIMEOUT

Job polling timed out

Yes

READ_ONLY_VIOLATION

Write operation blocked by read-only mode

No

WRITE_OPERATION_REQUIRES_FORCE

Write operation requires --force

Yes

CSV_PARSE_ERROR

CSV parsing failed

No

INTERNAL_ERROR

Internal error

No

Other formats

Format

Description

table

Readable table (default)

markdown

Markdown format

brief

Single-line summary

csv

CSV (data rows only)

ndjson

Newline-delimited JSON, with one record per line

AI Agent integration

maxc is purpose-built for AI Agent integration. The following sections cover its core design and usage patterns.

Unified JSON protocol

Every command's --json output follows a fixed Envelope protocol. Agents parse structured fields for reliable, predictable feedback.

  • status: Indicates success or failure.

  • data: The business data. The structure is fixed based on the command type.

  • error.code + error.suggestion: The error code and an executable suggestion for a fix.

  • agent_hints.next_actions: The next command that is recommended by the CLI. This is a complete and executable command line.

  • agent_hints.warnings: Risks to note, such as high costs or automatic partition selection.

Error self-healing

Each error response includes a suggestion field and agent_hints.next_actions that tell the Agent which command to run next:

Error scenario

Guidance received by the Agent

Table not found

Suggests running meta search to find tables with similar names

Column not found

Suggests running meta describe to view the table schema

Insufficient permissions

Suggests switching to the _dev project or checking the identity

SQL syntax error

Suggests running query cost or query explain for validation

Quota exceeded

Suggests running query cost to evaluate the query cost

Job timeout

Suggests running job wait or job status to continue tracking

The Agent reads error.suggestion and reruns the suggested command to recover automatically — no hard-coded error handling required.

Read-only safety

maxc blocks all DDL and DML statements (CREATE, DROP, INSERT, UPDATE, DELETE) on the client side, preventing accidental data modifications. This local check runs before SQL is submitted to the server, with zero latency and no cost.

Write operations require the user to explicitly pass --force — the Agent should never add this on its own. Data uploads via data upload use a separate Tunnel API channel and are not subject to this restriction.

Cost awareness

Before the Agent runs a query, it can estimate the cost using query cost or set a cost limit using --cost-check:

# Estimate the cost
aliyun maxc query cost "SELECT * FROM large_table" --json

# Set a cost threshold
aliyun maxc query "SELECT * FROM large_table" --cost-check 100 --json

Querying a partitioned table without a partition filter can trigger a full table scan with high costs. The Agent should determine the partition range with meta partitions or meta latest-partition before running the query.

SKILL layered knowledge architecture

SKILL is a set of structured guidance documents installed on the Agent platform that teach the Agent how to use maxc for MaxCompute data tasks.

# One-click installation to Claude Code
aliyun maxc agent skill install --json

# Install on other platforms
aliyun maxc agent skill install cursor --json
aliyun maxc agent skill install windsurf --json

SKILL uses layered loading to optimize LLM context window efficiency:

Layer

Content

Loading time

Main file SKILL.md

Intent-to-command mapping table, core principles, workflows, decision tables

Loaded automatically when a task is triggered

Reference documents

SQL dialect guide, query templates, partition strategies, error recovery manual, etc.

Loaded on demand (only when the Agent needs it)

Simple metadata queries require only the 270-line main file. Complex SQL generation or error recovery triggers on-demand loading of reference documents.

Supported Agent platforms:

Platform

Installation path

claude-code

~/.claude/skills/maxc-cli/

cursor

~/.cursor/skills/maxc-cli/

windsurf

~/.codeium/windsurf/skills/maxc-cli/

codex

~/.codex/skills/maxc-cli/

qwen

~/.qwen/skills/maxc-cli/

qoder

~/.qoder/skills/maxc-cli/

qoderwork

~/.qoderwork/skills/maxc-cli/

openclaw

~/.openclaw/workspace/skills/maxc-cli/

hermes

~/.hermes/skills/maxc-cli/

Other Agents

Specify --dir to install to any directory

SKILL management

# View the installation status on all platforms
aliyun maxc agent skill list --json

# Update installed SKILLs (after a new version is released)
aliyun maxc agent skill update --all --json

# View the differences between the installed version and the latest version
aliyun maxc agent skill diff claude-code --json

# Uninstall
aliyun maxc agent skill uninstall cursor --json

NL2SQL workflow

SKILL guides the Agent to convert natural language questions into SQL queries using the following flow:

User question
  ↓
1. meta search / meta list-tables     → Find relevant tables
  ↓
2. meta describe                      → Understand table schema and column meanings
  ↓
3. data sample                        → View actual data to confirm column value formats
  ↓
4. meta partitions / latest-partition → Determine the partition range
  ↓
5. query cost                         → Estimate the cost
  ↓
6. query                              → Run the query and return the result

SKILL reference documents include a 700+ line MaxCompute SQL dialect guide covering function differences, type traps, query templates, and common error fixes.

Semantic metadata

The meta semantic command attaches business semantics to a table — descriptions, use cases, sample questions, and column semantics. When meta describe reveals missing semantics, the Agent can generate and save them:

aliyun maxc meta semantic set my_table \
  --description "User behavior log table, recording click and view events within the app" \
  --usage-scenario "User behavior analysis, funnel conversion statistics" \
  --sample-questions '["What was the DAU for the last 7 days?", "What is the registration conversion rate trend?"]' \
  --json

Subsequent Agent sessions read this information, creating a cycle of use, accumulation, and reuse.

Agent context

The Agent can retrieve the complete current context at once using agent context:

aliyun maxc agent context --json

This command returns the current authentication status, project, schema, and configuration path, helping the Agent decide whether to guide the user through authentication or project switching.