← 返回
数据分析 Key

odps-sql

Use this skill when the user wants to query, analyze, or explore data in Alibaba Cloud ODPS (MaxCompute / 阿里云大数据计算服务). This skill executes SQL queries, lists...
在用户需要查询、分析或探索阿里云ODPS(MaxCompute/阿里云大数据计算服务)中的数据时使用此技能。该技能执行SQL查询,列出...
guilongzh
数据分析 clawhub v1.0.2 2 版本 99865.6 Key: 需要
★ 0
Stars
📥 743
下载
💾 26
安装
2
版本
#latest

概述

Setup (First-time only)

  1. Copy the credential template and fill in your values:

```bash

cd odps-sql/

cp config.example.env .env

# Edit .env with your Alibaba Cloud credentials

```

  1. Activate your Python environment and install dependency:

```bash

# conda users:

conda activate

# venv users:

source .venv/bin/activate

pip install pyodps

```

Executing Commands

Activate your Python environment first, then run all commands from the project root with:

SCRIPT=odps-sql/scripts/odps_helper.py

List tables

python $SCRIPT --list-tables

Filter by name:

python $SCRIPT --list-tables --pattern <keyword>

Get table schema

python $SCRIPT --describe <table_name>

Execute SQL query

python $SCRIPT --query "<SQL statement>" [--limit <n>]

Default limit is 100 rows.

Workflow for Data Tasks

Follow this pattern when the user asks about ODPS data:

  1. Discover — If the table name is unknown, run --list-tables --pattern to find it.
  2. Inspect — Run --describe to understand columns, types, and partition structure.
  3. Query — Construct the SQL and run --query. Always add a partition filter (WHERE dt = '...') for partitioned tables to avoid full scans.
  4. Present — Summarize the results clearly for the user.
  5. ODPS SQL Key Differences from Standard SQL

    FeatureStandard SQLODPS SQL
    --------------------------------
    String concat`a \\b`CONCAT(a, b)
    Current timeNOW()GETDATE()
    Null coalesceIFNULL(x,y)NVL(x, y)
    Regex matchREGEXPRLIKE
    Date 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 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

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