adaptive_apex_spider

Generates and validates Snowflake SQL from natural-language questions on Spider 2.0-Snow databases.

2|1|Updated Jun 10, 2026
One-click install
npx skills add https://github.com/Tencent/AdaSkill --skill adaptive-apex-spider-tencent
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: adaptive_apex_spider
Source: https://github.com/Tencent/AdaSkill/tree/main/skills/adaptive_text2sql_spider
Command: npx skills add https://github.com/Tencent/AdaSkill --skill adaptive-apex-spider-tencent

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires snowflake-connector-python, pandas.

What problem does it solve? Translating natural-language questions into correct, executable Snowflake SQL is error-prone: identifier quoting, mixed-data fact tables, JSON columns, epoch timestamps, and join semantics cause silent wrong answers. This Skill guides an agent through a structured workflow that retrieves relevant SQL tips, explores the live database, and verifies the final query before output. ## Core Features & Use Cases - Snowflake SQL Execution Tool: Run exploratory and validation queries against Snowflake with automatic credential discovery, result truncation, and per-column summary statistics for large result sets. - Keyword-Based Tip Selection: Deterministically match questions and schemas against 22 curated tips covering division safety, MetricID entity isolation, LATERAL FLATTEN for JSON, geospatial functions, join key normalization, and UNION ALL vs JOIN decisions. - Six-Phase Workflow: Tip retrieval, logical planning, targeted exploration, SQL generation, execution testing, and structured JSON output with selected tables, columns, and SQL. - Use Case: Given a question like "What is the total population of California in 2020?" against a CENSUS fact table, the Skill fires the critical MetricID isolation tip, explores distinct MetricID values, and produces a verified Snowflake query. ## Quick Start Ask the agent to answer a natural-language question against a Spider 2.0-Snow database schema and return the verified Snowflake SQL as JSON.

Frequently Asked Questions about adaptive_apex_spider

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert natural language questions to Snowflake SQL?▼

Provide the question, optional evidence, and the database schema. The workflow first selects relevant SQL tips by keyword matching, then explores actual column values with live queries, and finally generates and test-executes the Snowflake SQL before returning it as JSON.

How do I query Snowflake tables that mix multiple metrics in one Value column?▼

Filter by the type column before any aggregation, for example WHERE "MetricID" = 'Population'. Aggregating a mixed-data fact table without this filter sums unrelated metrics and always produces wrong results; this is the most critical rule for Spider 2.0-Snow.

Does this work with Snowflake JSON or VARIANT columns?▼

Yes. Use LATERAL FLATTEN(input => t."col") to expand JSON arrays into rows and key-path notation like f.value:"key"::STRING to extract fields. The tip selector automatically surfaces these patterns when the schema contains VARIANT or JSON columns.

What Python dependencies are required to run the Snowflake executor?▼

Install snowflake-connector-python and pandas via pip. You also need a Snowflake credential JSON file placed under benchmarks/text2sql/data/spider2-snow/credentials/, which the executor auto-discovers.

Why does my Snowflake query return invalid identifier errors?▼

Snowflake identifiers are case-sensitive when quoted, so enclose all table and column names in double quotes and use fully qualified names like "DATABASE"."SCHEMA"."TABLE". Unquoted identifiers silently match uppercase, causing mismatches.

When should I use UNION ALL instead of JOIN for multi-table questions?▼

Use UNION ALL followed by aggregation when records in one table are valid without a matching record in the other, such as sends versus opens. Use JOIN only for strict parent-child hierarchies, since JOIN drops unmatched independent events.