odpscmd-table
TLDR
[Interactive] Create a table with partition and lifecycle
[Interactive] Create a table based on the definition of another table
[Interactive] Add partition to a table
[Interactive] Delete partition from a table
[Interactive] Delete table
SYNOPSIS
odpscmd [-u <access_id>] [-p <access_key>] [-project <project_name>] [-e "<sql_statement>"] [-f <script_file>]
Inside shell: CREATE TABLE [IF NOT EXISTS] table_name ...;
Inside shell: DESC table_name;
Inside shell: DROP TABLE table_name;
PARAMETERS
-e
Executes the specified SQL statement directly from the terminal without entering the interactive shell.
-f
Specifies a local script file containing multiple SQL table operations to be executed sequentially.
-project
Defines the MaxCompute project scope for the table operations. Defaults to the project configured in odps_config.ini.
-u
The AccessKey ID used for authentication with the MaxCompute service.
-p
The AccessKey Secret associated with the provided AccessKey ID.
DESCRIPTION
The odpscmd-table context refers to the subset of commands within the MaxCompute (formerly ODPS) command-line tool specifically used for Table Management. It allows users to perform DDL (Data Definition Language) operations such as creating, altering, describing, and dropping tables, as well as DML (Data Manipulation Language) operations like querying and loading data. This utility serves as the primary interface for developers to interact with the distributed storage layer of Alibaba Cloud MaxCompute. It supports complex table structures, including partitioning, clustering, and external tables linked to OSS or other data sources. Commands can be executed in an interactive shell mode, passed as a string via the command line, or loaded from a script file for automation in ETL pipelines.
CAVEATS
Table operations are subject to MaxCompute SQL syntax constraints, which may differ slightly from standard HiveQL. Operations like DROP TABLE are irreversible if the backup/recycle bin feature is not enabled. Large metadata operations may experience slight propagation delays across distributed nodes.
INTERACTIVE VS NON-INTERACTIVE
While -e and -f are used for automation, running odpscmd without these flags enters an interactive shell where users can manage tables with full command history and auto-completion support.
HISTORY
Originally developed as part of the Open Data Processing Service (ODPS) at Alibaba, the tool was rebranded to MaxCompute. It evolved from a simple internal utility to a public cloud CLI tool designed to handle exabytes of data across massive clusters.


