Linux command
odps 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start the interactive client
odps
Execute a single SQL statement
odps -e "[SELECT * FROM table LIMIT 10;]"
Run a SQL script file
odps -f [query.sql]
Specify the target project
odps --project [my_project] --endpoint [https://service.cn-shanghai.maxcompute.aliyun.com/api]
Set output format
odps -e "[SELECT * FROM table;]" --format csv
说明
odps is the official command-line client for Alibaba Cloud's MaxCompute service (formerly Open Data Processing Service, abbreviated ODPS). It opens an interactive SQL prompt against a MaxCompute project where the user can run SQL queries, manage tables, partitions, resources, and functions, and submit MapReduce or Spark jobs. Non-interactive use is supported through -e for one-off statements and -f for SQL files, which is the common pattern in scheduled pipelines. The client reads endpoint URLs and credentials from conf/odps_config.ini so the same binary can target multiple regions by swapping configuration files.
参数
- -e _SQL_
- Execute a single statement and exit. Multiple statements may be separated with semicolons.
- -f _FILE_
- Execute the SQL script read from _FILE_.
- --project _NAME_
- MaxCompute project to use for the session. Overrides the value in odps_config.ini.
- --endpoint _URL_
- MaxCompute service endpoint URL. Required when not set in the configuration file.
- --access-id _ID_
- Alibaba Cloud Access Key ID. Reads from odps_config.ini by default.
- --access-key _KEY_
- Alibaba Cloud Access Key Secret.
- --format _FORMAT_
- Output format: text (default), csv, json.
- -r, --retry _N_
- Number of times to retry a failed network call.
- --help
- Display usage information.
FAQ
What is the odps command used for?
odps is the official command-line client for Alibaba Cloud's MaxCompute service (formerly Open Data Processing Service, abbreviated ODPS). It opens an interactive SQL prompt against a MaxCompute project where the user can run SQL queries, manage tables, partitions, resources, and functions, and submit MapReduce or Spark jobs. Non-interactive use is supported through -e for one-off statements and -f for SQL files, which is the common pattern in scheduled pipelines. The client reads endpoint URLs and credentials from conf/odps_config.ini so the same binary can target multiple regions by swapping configuration files.
How do I run a basic odps example?
Run `odps` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -e _SQL_ do in odps?
Execute a single statement and exit. Multiple statements may be separated with semicolons.