```bash
cd odps-sql/
cp config.example.env .env
# Edit .env with your Alibaba Cloud credentials
```
```bash
# conda users:
conda activate
# venv users:
source .venv/bin/activate
pip install pyodps
```
Activate your Python environment first, then run all commands from the project root with:
SCRIPT=odps-sql/scripts/odps_helper.py
python $SCRIPT --list-tables
Filter by name:
python $SCRIPT --list-tables --pattern <keyword>
python $SCRIPT --describe <table_name>
python $SCRIPT --query "<SQL statement>" [--limit <n>]
Default limit is 100 rows.
Follow this pattern when the user asks about ODPS data:
--list-tables --pattern to find it.--describe to understand columns, types, and partition structure.- Query — Construct the SQL and run
--query. Always add a partition filter (WHERE dt = '...') for partitioned tables to avoid full scans. - Present — Summarize the results clearly for the user.
ODPS SQL Key Differences from Standard SQL
Feature Standard SQL ODPS SQL --------- ------------- ---------- String concat `a \ \ b` CONCAT(a, b)Current time NOW()GETDATE()Null coalesce IFNULL(x,y)NVL(x, y)Regex match REGEXPRLIKEDate literal '2024-01-01'TO_DATE('2024-01-01','yyyy-mm-dd')
Partition filter is required for partitioned tables (partition column is usually dt):
SELECT * FROM table_name WHERE dt = '2024-01-01' LIMIT 100
See odps-sql/references/odps_sql_guide.md for a full SQL reference.
Error Handling
pyodps not found → Run install command in Setup step above- Missing credentials → Check that
odps-sql/.env exists and all four fields are filled in - Table not found → Use
--list-tables --pattern to find the correct name - SQL syntax error → Check the ODPS SQL differences table above; avoid MySQL/PostgreSQL-specific syntax
版本历史
共 2 个版本
-
v1.0.2
当前
2026-05-26 17:28 安全 安全
-
v1.0.1
2026-03-19 08:43 安全 安全
🔗 相关推荐
data-analysis
Stock Analysis
udiedrichsen {"answer":"基于雅虎财经数据,分析股票与加密货币。支持投资组合管理、自选股预警、股息分析、8维评分、热门趋势扫描及传闻/早期信号探测。适用于股票分析、持仓追踪、财报异动、加密监控、热门股追踪或提前发掘非主流传闻。"}
★ 270
📥 57,000
data-analysis
A股量化 AkShare
mbpz A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 165
📥 60,102
data-analysis
Data Analysis
ivangdavila {"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 199
📥 65,177