# alibabacloud-odps-sql-generation

Guides an AI agent to write, debug, and migrate MaxCompute SQL, with dialect rules, query patterns, and ODPS error code fixes.

Skill by Alibaba Cloud. Category: Data and backend.

## Install

Project (for this project only):

```sh
npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-odps-sql-generation
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

Global (for every project on this machine):

```sh
npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-odps-sql-generation -g
```

Works with: Claude Code, Codex CLI, Cursor, Antigravity, Copilot CLI, opencode.

## Tags

- Runs on your computer: It runs as a program on your machine, with your access.

## Security audits

- Gen Agent Trust Hub: Pass
- Socket: Pass
- Snyk: Pass

Installs: 200. Installs counted by skills.sh. [Open on skills.sh](https://www.skills.sh/aliyun/alibabacloud-aiops-skills/alibabacloud-odps-sql-generation)

## Source

[Open the source](https://github.com/aliyun/alibabacloud-aiops-skills/tree/HEAD/skills/analyticscomputing/odps/alibabacloud-odps-sql-generation). Checked 2026-10-10. This summary may contain AI-generated text, so it can be wrong. Check the source before you rely on it.

## SKILL.md

````markdown
---
name: alibabacloud-odps-sql-generation
description: "Provides MaxCompute SQL intelligent generation capabilities for AI agents, covering text2sql conversion principles, dialect syntax differences (DQL/DDL/DML), common query pattern templates (Top N, PIVOT, window functions, etc.), and ODPS error code diagnostics. Use when generating, debugging, or migrating MaxCompute / ODPS SQL."
license: Apache-2.0
metadata:
  domain: coding
  owner: MaxCompute
  contact: jiexian.hc@alibaba-inc.com, zhipeng.gzp@alibaba-inc.com
  version: 1.0.0
---

# MaxCompute SQL Engine Syntax Skill

Provides MaxCompute SQL engine syntax guidance for text2sql scenarios. MaxCompute is based on Hive SQL extensions and has significant differences from ANSI standard SQL.

## Usage

Load corresponding reference files based on question type (can be combined). The `load` column indicates relative loading weight (heavy ≈ large, medium ≈ moderate), for budget estimation, not exact token counts. Each file's opening paragraph describes its own scope.

| Trigger condition | File | load |
|---|---|---|
| NL→SELECT generation / text2sql (determine intent, granularity, table-column mapping, output format first) | `references/text2sql_principles.md` | light |
| Generate MaxCompute SELECT queries (dialect rules, DQL default must-read) | `references/maxcompute_select_guide.md` | heavy |
| Match query pattern keywords: Top N / top-N per group / year-over-year / month-over-month / consecutive N days / retention / row-to-column / column-to-row / PIVOT / UNPIVOT / array expansion / LATERAL VIEW / EXPLODE / JSON extraction / GET_JSON_OBJECT / cumulative / running total / Range Join / GROUPING SETS / CUBE / ROLLUP / pagination / paging | `references/sql_query_patterns.md` | medium |
| SQL execution failure requiring diagnosis and recovery (including `ODPS-0xxx` error codes)| `references/sql_common_errors.md` | medium |

> Relationship: `text2sql_principles.md` provides engine-independent NL→SELECT generation principles; `maxcompute_select_guide.md` is the **single authoritative source** for MaxCompute DQL dialect rules (unsupported syntax/functions/partitioning/types/SET parameters). `sql_query_patterns.md` provides **query template snippets** only, without duplicating rules.

## Out of Scope

The following scenarios exceed this skill's scope:

- **MaxCompute non-SQL interfaces**: Tunnel / MapReduce / Graph / PyODPS DataFrame API, SDK invocation methods
- **Console and permission management**: Quota requests, IAM / RAM roles, project owner operations — use Aliyun console or support tickets
- **Execution plan-level deep tuning**: Only lists common SET parameters and hints; does not analyze specific plan nodes / Fuxi DAG / data skew formation paths
- **Cluster-side / platform-side failures**: Worker crashes, resource scheduling failures, MetaStore transaction conflicts, storage layer read/write errors — these are support ticket issues, not SQL issues
````

- Previous: [alibabacloud-ddos-security-monitor](https://syn4pse.dev/terminal/alibabacloud-ddos-security-monitor.md)
- Next: [alibabacloud-sas-alert-handler](https://syn4pse.dev/terminal/alibabacloud-sas-alert-handler.md)
- [Terminal](https://syn4pse.dev/terminal.md)
- [Suggest a change](mailto:terminal@syn4pse.dev?subject=Terminal%20suggestion)
