All Products
Search
Document Center

MaxCompute:MaxCompute client

Last Updated:Mar 25, 2026

The MaxCompute client (odpscmd) is a command-line interface for running commands and managing MaxCompute projects from your local machine. This topic describes how to install, configure, and use odpscmd.

Requirements and compatibility

  • Java: Java 8 or later is required. odpscmd v0.28.0 and later support JDK 1.9. Earlier versions support only JDK 1.8.

  • Version compatibility: Command syntax and output formats may differ across client versions. Client output formats are not forward-compatible — do not parse client output for automation. After starting the client, verify the version number in the command-line interface. For all available versions, see aliyun-odps-console releases.

  • Encoding: The client uses UTF-8 encoding by default. If your local environment uses a different encoding, Chinese characters in query results or uploaded files may appear as garbled text. This can happen when querying MaxCompute tables or uploading local data files with Tunnel commands.

Billing

Connecting to a MaxCompute project with odpscmd is free. Operations you run through the client — such as SQL queries and write commands — may incur charges for compute and storage. For details, see Billing items and methods.

Install and configure odpscmd

Starting with v0.27.0, odpscmd supports MaxCompute V2.0 data types. For the full list of supported types, see MaxCompute V2.0 data types.

  1. Download the MaxCompute client package from GitHub. Download the latest odpscmd_public.zip from the releases page.

    If the GitHub link is not accessible, download the package from OSS instead.
  2. Extract the package. The extracted directory contains four folders: bin, conf, lib, and plugins.

  3. In the conf folder, open odps_config.ini and configure the parameters below. The file uses # for comments. The following table describes the parameters.

    ParameterRequiredDescriptionExample
    project_nameYesThe MaxCompute project to access. If your workspace is in standard mode, distinguish between production and development (_dev) project names. To find your project name: log on to the MaxCompute console, select your region, then go to Manage Configurations > Projects. See Differences between workspace modes.doc_test_dev
    access_idYesYour Alibaba Cloud account or RAM user AccessKey ID. Get it from the AccessKey management page.
    access_keyYesThe AccessKey secret that matches your AccessKey ID.
    end_pointYesThe MaxCompute service endpoint. Set this based on your project's region and network type. For endpoints by region and network, see Endpoint. This must be the MaxCompute endpoint, not the Tunnel endpoint. An incorrect endpoint causes connection errors.http://service.cn-hangzhou.maxcompute.aliyun.com/api
    log_view_hostNoThe LogView URL for viewing job runtime information and troubleshooting failures. We recommend setting this parameter. Without it, you cannot quickly locate issues when jobs fail. Fixed value: http://logview.odps.aliyun.com.http://logview.odps.aliyun.com
    https_checkNoWhether to use HTTPS for requests. True or False. Default: False.True
    data_size_confirmNoMaximum input data size in GB. No limit applies. Recommended: 100.100
    update_urlNoReserved parameter. Leave blank.
    use_instance_tunnelNoWhether to use InstanceTunnel to download SQL query results. True or False. Default: False.True
    instance_tunnel_max_recordNoMaximum number of records returned for SQL query results when use_instance_tunnel is True. Maximum: 10000.10000
    tunnel_endpointNoThe public endpoint for the Tunnel service. If not set, Tunnel auto-routes based on your MaxCompute endpoint's region and network. If set, Tunnel uses that endpoint and does not auto-route. For Tunnel endpoints by region and network, see Endpoint.http://dt.cn-hangzhou.maxcompute.aliyun.com
    set.<key>NoSet properties for your MaxCompute project. For available properties, see Property list.set.odps.sql.decimal.odps2=true

Start the MaxCompute client

Before you begin, ensure that you have:

Start the client using one of the following methods.

Method 1: Double-click the script

In the bin folder of your installation directory:

  • Windows: Double-click odpscmd.bat.

  • macOS: Double-click odpscmd.

When the client starts and connects successfully, you see a confirmation message.

image.png

Method 2: Run from the command line

Navigate to the bin folder in your command-line window, then run:

  • Windows: odpscmd

  • Linux or macOS: sh odpscmd

  • Ubuntu: ./odpscmd (running sh odpscmd returns an error on Ubuntu)

When the client starts and connects successfully, you see a confirmation message.

image.png
When starting from the command line, you can pass startup parameters to run commands directly. See Startup parameters.

Verify your connection

After the client starts, run the following command to confirm your connection:

odps@project_name>whoami;

A successful connection returns your account details:

  • Name: Your account name.

  • Source IP: The IP address of your local machine.

  • End_Point: The MaxCompute service endpoint.

  • Project: Your MaxCompute project name.

  • Schema: The schema in your project.

Common operations

Get command help

View command help in the MaxCompute client

Inside the MaxCompute client:

-- View help for all commands.
odps@project_name>help;
-- Equivalent to:
odps@project_name>h;

-- View help for commands matching a keyword (for example, table-related commands).
odps@project_name>help table;
Important

The read command uses SQL syntax and is subject to SQL pricing.

View command help in the system command-line window

From the system command-line window:

...\odpscmd\bin>odpscmd -h

Exit the client

odps@project_name>quit;
-- Equivalent to:
odps@project_name>q;

Run the tunnel download command

The first time you run tunnel download, the client creates a session folder at plugins/dship in your installation directory.

If multiple users share the same device, keep data secure by using one of these approaches:

  • Use your operating system's folder permissions to restrict access to the session folder.

  • Add -sd <session-folder> or -session-dir <session-folder> to the tunnel download command to store data in a separate session folder. For full command details, see Download.

Startup parameters

Use startup parameters to pass commands directly when launching odpscmd from the command line.

Usage: odpscmd [OPTION]...
    --help                                  (-h) for help
    --config=<config_file>                  specify another config file
    --project=<prj_name>                    use project
    --endpoint=<http://host:port>           set endpoint
    -k <n>                                  skip beginning queries and start from specified position
    -r <n>                                  set retry times
    -f <"file_path;">                       execute commands in file
    -e <"command;[command;]...">            execute commands, including SQL commands
ParameterDescriptionExample
--help or -hView help for all commands.odpscmd --help
--configPath to odps_config.ini. Default: odpscmd_public/conf/odps_config.ini.odpscmd --config=D:/odpscmd/conf/odps_config.ini
--projectThe MaxCompute project to access.odpscmd --project=doc_test
--endpointThe MaxCompute service endpoint. See Endpoint.odpscmd --endpoint=http://service.cn-shanghai.maxcompute.aliyun.com/api
-kRun statements starting from a specific position. If n≤0, starts from the first statement. Statements are separated by semicolons.Skip 2 statements, start from the 3rd: odpscmd -k 3 -e "drop table t;create table t (dummy string);insert overwrite table t select count(*) from t;"
-rNumber of retries for failed jobs.odpscmd -r 2 -e "select * from sale_detail;select * from table_test;"
-fRead commands from a file.Create D:/script.txt containing SQL statements, then run: ...\odpscmd\bin>odpscmd -f D:/script.txt;
-eRun commands directly.odpscmd -e "select * from sale_detail;"

Capture raw query output

To capture the output of -e without extra metadata (runtime info, table headers), set use_instance_tunnel=false in odps_config.ini, then suppress headers at query time:

-- Windows command prompt: redirect output to a file with no headers.
...\odpscmd\bin>odpscmd -e "set odps.sql.select.output.format={""needHeader"":false,""fieldDelim"":"" ""};select * from noheader;" >D:\test.txt

-- Shell: redirect output to a file with no headers.
/Users/.../odpscmd/bin/odpscmd -e "set odps.sql.select.output.format={\"needHeader\":false,\"fieldDelim\":\"\"};select * from noheader;" >/Users/A/temp/test.txt
-- Output (no headers, raw data only):
-- 1
-- 2
-- 3

Troubleshooting

Error: no java found

Java is not installed on your machine. Install Java and set the JAVA_HOME environment variable. odpscmd v0.28.0 and later support JDK 1.9; earlier versions require JDK 1.8.

Error: Could not find or load main class com.aliyun.openservices.odps.console.ODPSConsole

The folder name contains spaces or special characters — typically because the package was downloaded a second time and renamed to odpscmd_public (1). Remove all spaces and special characters from the folder name.

Error: Accessing project '\<projectname\>' failed: ODPS-0420111: Project not found

The project name in odps_config.ini is incorrect. Log on to the MaxCompute console, select your region, go to Manage Configurations > Projects, and copy the correct project name.

Error: ODPS-0420095: Access Denied - Authorization Failed [4002], You don't exist in project \<projectname\>

Your account is not added to the target project, or the project name is wrong. Contact the project owner to add your Alibaba Cloud account or RAM user. See Add an Alibaba Cloud account (project level) or Add a RAM user (project level).

Error: InvalidProjectTable or connect timed out

The end_point value is wrong. Common mistakes include using the classic network endpoint for an internal network connection, or entering the Tunnel endpoint instead of the MaxCompute endpoint. Use the Endpoint documentation to find the correct endpoint for your project's region and network. The end_point parameter must hold the MaxCompute endpoint, not the Tunnel endpoint.

Error: Accessing project '\<projectname\>' failed: \<endpoint\>

The end_point value contains a typo — for example, ch-hangzhou instead of cn-hangzhou. Copy the endpoint directly from the Endpoint documentation instead of typing it manually.

Version history

The following table lists recent updates to odpscmd. For the full changelog, see aliyun-odps-console releases.

VersionTypeDescription
v0.52.3-publicNew featureSupport STS tokens as temporary security credentials.
Bug fixUpdate Apache Arrow library to fix dependency compatibility issues.
v0.52.2-publicNew featureAdd skip_progress to control progress reporting for MaxCompute Query Acceleration (MCQA) 2.0 jobs.
EnhancementImprove MCQA V2 support and enhance compact command with support for specific compact IDs.
v0.51.2-publicBug fixUpgrade dependencies to fix CVE vulnerabilities.
v0.51.1-publicNew featureAdd acceleration for external volume downloads.
EnhancementRefactor DescribeTableCommand, ShowPartitionsCommand, and ShowTablesCommand to better handle external projects V2.
v0.51.0-publicNew featureQuota caching, enhanced compact command, and SQL TUNE command for query plan analysis and optimization. Evaluate candidate execution plans. Add tuning history and reports.
EnhancementImprove MCQA 2.0 session management and rework network_read_timeout and network_connect_timeout configuration.
v0.50.0-publicNew featureSupport MCQA 2.0 job submission and UseQuotaCommand for specifying interactive quota groups.
v0.48.0-publicNew featureUpgrade odps-sdk from 0.47.0-public to 0.48.6-public. Add data masking info to DESC EXTENDED.
Bug fixMCQA mode now detects fallback behavior more accurately and avoids duplicate LogView displays.
v0.47.0-publicNew featureAdd http command and --keep-session-variables startup parameter.
EnhancementAdd TIMESTAMP_NTZ and JSON support for read, Tunnel QuotaName (-qn) and DATETIME format (-dfp) parameters for Tunnel upload/download, grep for HistoryCommand, DROP project syntax, and improved setproject for complex types.
v0.46.5-publicNew featureSupport JSON data type for Tunnel operations.
v0.46.4-publicNew featureUPSERT operations through Tunnel, timezone handling with SET odps.sql.timezone=UTC, and improved security config commands.
EnhancementExpand DescribeTableCommand to show more storage layer details.
v0.45.1-publicNew featureShow storage layer info, last modified times, and storage sizes per layer in DescribeTableCommand.
v0.45.0-publicNew featureAdd attach_session_timeout to control MCQA session attach timeout.
EnhancementAdd attachTimeout to session builder config and improve dship command and TopInstanceCommand.
v0.43.2-publicNew featureSupport external volume creation and show commands for built-in functions.
v0.40.10-publicBug fixRemove Log4j dependency.
v0.40.8-publicNew featureSupport schema-based project storage. See Schema operations.
v0.37.5-publicNew featureSupport complex data types for Tunnel uploads and downloads.
v0.37.4-publicEnhancementImprove command help text and add additional partition property info to desc extended partition.
v0.36.0-publicNew featureSupport external project connections to Data Lake Formation (DLF).
Bug fixFix nanosecond handling when downloading TIMESTAMP data.

What's next