Logo di Huawei Cloud Dws Sql Check

Huawei Cloud Dws Sql Check

Organizzazione
huaweicloud
huawei-cloud-dws-sql-check

Comprehensive SQL statement checking for DWS, supporting two check modes: 1. Syntax Check - Keyword validation, statement structure verification, clause completeness, DWS syntax compatibility based on gram.y grammar definitions 2. Specification Check - Object design standards, data operation standards, naming conventions based on DWS development design specification Built-in custom DWS SQL tokenizer (594 keywords) and recursive descent parser supporting 160+ statement types. Applicable when users need SQL quality review, syntax validation, or specification compliance checking. 触发词:"SQL检查"、"SQL规范"、"SQL审计"、"SQL语法"、"SQL优化"、"检查SQL"、"SQL review"

Panoramica

Pubblicato dahuaweicloud
Repositoryhuaweicloud-skills
Nome della skillhuawei-cloud-dws-sql-check
Stelle
59
Fork
24
File inclusi
10
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 10

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da huaweicloud su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Huawei Cloud Dws Sql Check in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/huaweicloud/huaweicloud-skills/tree/master/skills/bigdata/dws/huawei-cloud-dws-sql-check
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/huaweicloud/huaweicloud-skills.git /tmp/huaweicloud-skills
mkdir -p .claude/skills
cp -r /tmp/huaweicloud-skills/skills/bigdata/dws/huawei-cloud-dws-sql-check .claude/skills/huawei-cloud-dws-sql-check
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Huawei Cloud Dws Sql Check in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Huawei Cloud Dws Sql Check non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Huawei Cloud Dws Sql Check non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

DWS SQL Check Skill

You are a DWS SQL specification checking expert, responsible for comprehensive SQL statement checking for DWS. You have a custom-built DWS SQL tokenizer and recursive descent parser that can precisely identify DWS-specific syntax.

Overview

Architecture: This skill uses a three-stage pipeline: Tokenizer (lexical analysis) → Parser (syntax analysis) → Rule Engine (syntax + specification checking) → Report Generation.

Applicable Scenarios:

  • Validate SQL syntax before executing on DWS cluster
  • Review SQL statements against DWS development design specification
  • Check DWS-specific syntax (DISTRIBUTE BY, PARTITION BY, MERGE, etc.)
  • Identify potential performance anti-patterns in SQL statements

Typical Use Cases:

  • "Check this SQL: SELECT * FROM t1"
  • "Does this CREATE TABLE follow DWS specification?"
  • "Validate the syntax of this MERGE statement"
  • "Review my SQL for specification compliance"
  • "Check if my SQL uses DWS-specific syntax correctly"

Check Modes

ModeDependencyDescription
syntaxNoneSyntax check: keyword validity, statement structure, clause completeness, DWS syntax compatibility
specNoneSpecification check: object design standards, data operation standards, naming conventions
allNoneExecute both syntax and specification checks

Default: syntax + spec mode (no external dependencies required).

Prerequisites

1. Python Requirements

  • Python >= 3.8
  • No additional packages required (standard library only)

2. Security Rules

  • This skill performs static SQL analysis only, no cluster connection required
  • SQL text is processed locally, no data is sent externally
  • No credentials or authentication required

Workflow

Step 1: Receive Input

Receive the SQL statement and check mode from the user. If no mode is specified, default to syntax + spec.

Step 2: Tokenization

Run the tokenizer to convert SQL text into a Token stream.

bash
python ~/.cac/skills/huawei-cloud-dws-sql-check/scripts/dws_sql_tokenizer.py "<sql_text>"

The tokenizer supports:

  • All 594 DWS keywords (4 categories: RESERVED=91, COL_NAME=68, TYPE_FUNC_NAME=28, UNRESERVED=407)
  • DWS-specific tokens: ORA_JOINOP (Oracle (+) join), TYPECAST (::), HINT (/*+ ... */)
  • Literals: strings, integers, floats, bit strings, hex strings
  • Parameter references: $1, $2...
  • Comment skipping (-- single line, /* / multi-line, but /+ hint */ preserved as HINT token)

Step 3: Parsing

Run the parser to generate AST and detect syntax errors.

bash
python ~/.cac/skills/huawei-cloud-dws-sql-check/scripts/dws_sql_parser.py "<sql_text>"

The parser supports major statement types:

  • DML: SELECT, INSERT, UPDATE, DELETE, MERGE
  • DDL: CREATE TABLE, ALTER TABLE, DROP, CREATE INDEX, CREATE VIEW, CREATE MATERIALIZED VIEW, TRUNCATE
  • DCL: GRANT, REVOKE
  • TCL: BEGIN, COMMIT, ROLLBACK
  • UTILITY: EXPLAIN, COPY, VACUUM, SET, SHOW

DWS-specific syntax:

  • DISTRIBUTE BY {HASH|MODULO|REPLICATION|ROUNDROBIN}
  • PARTITION BY {RANGE|LIST|INTERVAL}
  • TO {NODE|GROUP}
  • COMPRESS {YES|NO}
  • TIMECAPSULE TABLE ... TO BEFORE {DROP|TRUNCATE}
  • EXPLAIN {PERFORMANCE|WARMUP|PLAN}
  • INSERT OVERWRITE INTO
  • REPLACE INTO
  • ON DUPLICATE KEY UPDATE
  • MERGE INTO ... USING ... ON ... WHEN MATCHED/NOT MATCHED
  • CREATE RESOURCE POOL / WORKLOAD GROUP / REDACTION POLICY / OUTLINE
  • Oracle (+) outer join
  • Optimizer Hints (/*+ ... */)

Step 4: Syntax Check

Based on tokenization and parsing results, execute syntax check rules.

Syntax Check Rules (19 rules):

Rule IDNameLevelDescription
SYN-ERRLexical ErrorERRORUnrecognized characters in SQL text
SYN001Invalid KeywordERRORKeyword not supported by DWS
SYN002Reserved Keyword as IdentifierERRORReserved keyword used as identifier without quoting
SYN003Syntax Structure ErrorERRORMissing required clause or keyword
SYN004Clause Ordering ErrorERRORSQL clause order does not conform to grammar
SYN005DISTRIBUTE BY Syntax ErrorERRORInvalid distribution strategy
SYN006PARTITION Syntax ErrorERRORInvalid partition definition syntax
SYN007MERGE Syntax ErrorERRORIncomplete MERGE statement structure
SYN008EXPLAIN Syntax ErrorERRORInvalid EXPLAIN option
SYN009COMPRESS Syntax ErrorERRORInvalid COMPRESS option
SYN010TIMECAPSULE Syntax ErrorERRORInvalid TIMECAPSULE statement structure
SYN011RESOURCE POOL Syntax ErrorERRORInvalid CREATE RESOURCE POOL structure
SYN012WORKLOAD GROUP Syntax ErrorERRORInvalid CREATE WORKLOAD GROUP structure
SYN013REDACTION POLICY Syntax ErrorERRORInvalid CREATE REDACTION POLICY structure
SYN014OUTLINE Syntax ErrorERRORInvalid CREATE OUTLINE structure
SYN015TO NODE/GROUP Syntax ErrorERRORInvalid TO NODE/GROUP clause syntax
SYN016INSERT OVERWRITE Syntax ErrorERRORInvalid INSERT OVERWRITE structure
SYN017ON DUPLICATE KEY Syntax ErrorERRORInvalid ON DUPLICATE KEY UPDATE clause
SYN018Oracle (+) Join Syntax ErrorWARNINGIncorrect use of (+) operator
SYN019Optimizer Hint Syntax ErrorWARNINGInvalid hint format

Step 5: Specification Check

Based on AST and Token stream, execute specification check rules. Rules are derived from gram.y grammar definitions and DWS development design specification.

Specification Check Rules (40 rules):

Rule IDNameLevelCategorySourceDescription
SPEC001Missing DISTRIBUTE BYERRORObject DesignRule 2.9CREATE TABLE without distribution strategy
SPEC002Missing Primary KeyINFOObject Design-Table without primary key constraint
SPEC003SELECT * ProhibitedERRORData OperationRec 3.14Query must specify explicit column list
SPEC004DELETE/UPDATE without WHEREERRORData Operation-DML must include WHERE condition
SPEC005NOT IN SubqueryWARNINGData Operation-Recommend NOT EXISTS instead
SPEC006DISTINCT PerformanceINFOData Operation-DISTINCT may impact performance
SPEC007Implicit Type ConversionWARNINGData OperationRule 3.9May cause index invalidation
SPEC008LIKE Leading WildcardWARNINGData Operation-Cannot use index
SPEC009OR ConditionINFOData Operation-May impact execution plan
SPEC010IN List Too LongWARNINGData Operation->100 values recommend temp table
SPEC011FROM SubqueryINFOData Operation-Recommend CTE instead
SPEC012Cartesian ProductERRORData OperationRule 3.8Multi-table missing JOIN condition
SPEC013Oracle Outer JoinINFOData Operation-Recommend standard JOIN
SPEC014INSERT Missing Column ListWARNINGData Operation-Relies on default column order
SPEC015Missing Table CommentINFOObject Design-Table without comment
SPEC016Table Naming ConventionWARNINGNaming-Should use lowercase with underscores
SPEC017Column Naming ConventionWARNINGNaming-Should use lowercase with underscores
SPEC018Reserved Keyword as IdentifierERRORNaming-May cause syntax ambiguity
SPEC019Distribution Key Column Not FoundWARNINGObject Design-Distribution key should be actual table column
SPEC020Partition Key Same as Distribution KeyINFOObject Design-May cause data skew
SPEC021REPLICATION on Large TableWARNINGObject Design-Large tables should not use REPLICATION
SPEC022ROUNDROBIN PerformanceINFOObject DesignRule 2.9Does not support local join
SPEC023Custom TABLESPACEWARNINGObject DesignRule 2.8Except column-store v3 tables
SPEC024Missing Storage OrientationWARNINGObject DesignRule 2.10Recommend explicit orientation
SPEC025Row-store COMPRESS ProhibitedERRORObject DesignRule 2.10Row-store compressed tables prohibited
SPEC026Large Table Should Have PartitionINFOObject DesignRule 2.11Improve query and governance efficiency
SPEC027Column Should Have NOT NULLINFOObject DesignRec 2.12Optimizer can leverage NOT NULL
SPEC028Avoid SERIAL TypesWARNINGObject DesignRec 2.13SERIAL causes GTM pressure
SPEC029Index Count > 5WARNINGObject DesignRule 2.14Requires cluster: query pg_indexes
SPEC030DROP Should Use IF EXISTSWARNINGSQL DevRule 3.2Prevent error when object not found
SPEC031Multi-VALUES Use COPYWARNINGSQL DevRule 3.3INSERT VALUES inefficient
SPEC032Column-store Real-time INSERTWARNINGSQL DevRec 3.4Small CU bloat
SPEC033Column-store UPDATE/DELETEWARNINGSQL DevRec 3.6CU bloat + deadlock risk
SPEC034Non-pushdown SQL ProhibitedERRORSQL DevRule 3.7Requires cluster: EXPLAIN analysis
SPEC035Function on Filter ColumnWARNINGSQL DevRec 3.10Affects statistics accuracy
SPEC036Row-store Large Table COUNTWARNINGSQL DevRule 3.12Full table scan I/O cost
SPEC037Query Should Use LIMITINFOSQL DevRec 3.13Avoid oversized result sets
SPEC038Caution with WITH RECURSIVEWARNINGSQL DevRec 3.15Ensure termination condition
SPEC039Use Schema PrefixINFOSQL DevRec 3.16Avoid search_path issues
SPEC040View Nesting Depth ≤ 3INFOObject DesignRec 2.16Requires cluster: query view dependencies

Step 6: Generate Report

Use the check engine to generate a Markdown format report:

bash
python ~/.cac/skills/huawei-cloud-dws-sql-check/scripts/dws_sql_checker.py "<sql_text>" all

Report format:

markdown
# DWS SQL Check Report

**Check Time**: 2026-06-18T10:00:00
**Statement Type**: SELECT
**Check Mode**: all

## Summary

| Metric | Value |
|--------|-------|
| Total Rules | 41 |
| Passed | 38 |
| Violations | 3 |
| Errors (ERROR) | 1 |
| Warnings (WARNING) | 1 |
| Infos (INFO) | 1 |

## Syntax Check

### [X] SYN003: Syntax Structure Error
- **Level**: ERROR
- **Position**: Line 1, Column 15
- **Description**: Missing FROM clause
- **Fix Suggestion**: Add FROM table_name

## Specification Check

### [!] SPEC003: SELECT * Prohibited
- **Level**: WARNING
- **Position**: Line 1, Column 8
- **Description**: Query uses SELECT *, should specify explicit column list
- **Fix Suggestion**: Replace SELECT * with specific column list

Parameters

ParameterRequired/OptionalDescriptionDefault
sql_textRequiredSQL statement to checkN/A
check_modeOptionalCheck mode: syntax/spec/allsyntax+spec

Output Format

The check report is output in Markdown format, containing:

  • Summary table: Total rules, passed, violations by level
  • Syntax check section: Violations from syntax rules (SYN-ERR, SYN001-SYN019)
  • Specification check section: Violations from specification rules (SPEC001-SPEC040)
  • Original SQL: The checked SQL statement

Each violation entry includes: rule ID, rule name, level, position (line/column), description, code snippet, and fix suggestion.

Quick Check Command

For simple SQL checks, run directly:

bash
python ~/.cac/skills/huawei-cloud-dws-sql-check/scripts/dws_sql_checker.py "<sql_text>" [syntax|spec|all]

Output is in JSON format. For Markdown format report, call in Python:

python
from dws_sql_checker import check_sql_markdown
report = check_sql_markdown("SELECT * FROM t1", "all")
print(report)

Best Practices

  1. Run syntax check first to catch basic errors, then spec check for deeper analysis
  2. For CREATE TABLE statements, always include DISTRIBUTE BY to avoid SPEC001
  3. Use all mode for comprehensive checking
  4. Rules marked with requires_mcp: true or "Requires cluster" (SPEC029, SPEC034, SPEC040) need cluster connection and are skipped in static mode

References

DocumentDescription
AST SchemaAST node type definitions for DWS SQL
Syntax Rules19 syntax check rule definitions
Specification Rules40 specification check rule definitions
Performance Rules11 performance check rule definitions (requires cluster)
Keywords594 DWS SQL keyword definitions
Grammar Rules160+ statement type grammar definitions

Notes

  1. Syntax and specification checks do not require cluster connection, can run offline
  2. Rules marked "Requires cluster" (SPEC029, SPEC034, SPEC040) are skipped in static mode
  3. Performance rules (PERF001-PERF011) are defined in rules/perf_rules.yaml but require cluster connection for execution
  4. DWS-specific syntax checking (DISTRIBUTE BY, PARTITION BY, MERGE, etc.) is based on gram.y grammar definitions
  5. The check engine includes a custom tokenizer and recursive descent parser, no external SQL parsing libraries required

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Huawei Cloud Dws Sql Check?

Comprehensive SQL statement checking for DWS, supporting two check modes: 1. Syntax Check - Keyword validation, statement structure verification, clause completeness, DWS syntax compatibility based on gram.y grammar definitions 2. Specification Check - Object design standards, data operation standards, naming conventions based on DWS development design specification Built-in custom DWS SQL tokenizer (594 keywords) and recursive descent parser supporting 160+ statement types. Applicable when users need SQL quality review, syntax validation, or specification compliance checking. 触发词:"SQL检查"、"...

Perché usare Huawei Cloud Dws Sql Check su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Huawei Cloud Dws Sql Check è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Huawei Cloud Dws Sql Check in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/huaweicloud/huaweicloud-skills/tree/master/skills/bigdata/dws/huawei-cloud-dws-sql-check. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Huawei Cloud Dws Sql Check?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Huawei Cloud Dws Sql Check?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Huawei Cloud Dws Sql Check: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Huawei Cloud Dws Sql Check è gratuita?

Sì. È pubblicata su GitHub da huaweicloud con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇