AI NL2SQL

# NL2SQL · Natural Language to SQL

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "AI NL2SQL" with this command: npx skills add billjamno58/ai-nl2sql

NL2SQL · Natural Language to SQL

Upload CSV/Excel files → Ask questions in plain English → AI generates and executes SQL → Returns readable results + optional charts


Trigger Phrases

nl2sql text to sql natural language sql ask database csv query excel sql 数据查询 自然语言查数


Usage

Command Line

# Basic query
python -m scripts.main "Which product has the highest sales?" -f data/sales.csv

# Generate chart
python -m scripts.main "Monthly sales trend" -f data/sales.csv --chart line

# Export results
python -m scripts.main "Top 10 customers" -f data/customers.csv --format csv -o result.csv

Python API

from scripts import NL2SQLService, QueryRequest

service = NL2SQLService(api_key="your-api-key")

request = QueryRequest(
    question="Which product has the highest sales?",
    files=["data/sales.csv"],
    chart_type="bar",
    explain=True
)

response = service.query(request)

if response.success:
    print(f"SQL: {response.sql}")
    print(f"Results: {response.data}")

Parameters

QueryRequest

ParameterTypeRequiredDescription
questionstrYesNatural language question
filesList[str]YesFile paths (CSV/Excel)
chart_typestrNoChart type: bar/line/pie/scatter/area/histogram
explainboolNoWhether to explain the SQL
output_formatstrNoOutput format: markdown/json/csv (default: markdown)

QueryResponse

FieldTypeDescription
successboolWhether the query succeeded
sqlstrGenerated SQL
explanationstrSQL explanation
row_countintNumber of result rows
columnsList[str]Column names
dataList[dict]Result data
chart_base64strChart image as base64
errorstrError message if failed

Supported Formats

FormatExtensionsNotes
CSV.csvUTF-8/GBK auto-detected
Excel.xlsx, .xlsMulti-sheet supported

Tech Stack

  • Parsing: pandas, openpyxl
  • AI: OpenAI GPT-4 (via user-provided API key)
  • Charts: matplotlib
  • Execution: pandasql (SQL on DataFrame, fully offline sandbox)

Tiered Features

FeatureFREEPRO
Queries3 per sessionUnlimited
File size5 MB max200 MB max
JOIN supportNoYes
Chart typesbar, line, pieAll types
Export formatsCSVCSV, Excel, PDF
AI SQL generationNo (rule-based)Yes (GPT-4)

Billing

$0.01 USDT per call — billed via SkillPay at https://skillpay.me/ai-nl2sql

Privacy Note: Your Feishu User ID (Open ID) may be transmitted to skillpay.me for billing purposes only.

| Price | $0 (FREE tier) | $0.01 / call (PRO tier) |

For paid use, visit https://skillpay.me/ai-nl2sql


Required Environment Variables

VariableDescription
SKILL_BILLING_API_KEYSkillPay Builder API Key (from skillpay.me)
SKILL_BILLING_SKILL_IDSkill ID on SkillPay (default: ai-nl2sql)

API Key Format

Any non-empty string works as an API key. The tier is determined automatically:

  • No API key → FREE tier (rule-based SQL only)
  • Any API key → PRO tier (GPT-4 powered)

Slug

ai-nl2sql


Security Notes

  • SQL Safety: All AI-generated SQL passes through an SQLValidator that blocks all non-SELECT queries (DROP, DELETE, INSERT, UPDATE, CREATE, EXEC, GRANT, etc.). Only read-only queries are permitted.
  • Data Isolation: SQL execution runs entirely in a local pandas DataFrame sandbox. No real database connection is made. No data leaves the user's environment.
  • External Data Transmission: Your Feishu User ID (Open ID) is transmitted to skillpay.me exclusively for billing purposes. See ## Billing for details.

Notes

  1. All SQL execution runs in a local pandas DataFrame sandbox — no real database connection
  2. AI SQL generation requires a valid OpenAI API key provided by the user
  3. Network errors gracefully degrade to FREE tier

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Gigo Lobster Resume

🦞 GIGO · gigo-lobster-resume: 续跑入口:v2 stable 当前会清理旧 checkpoint 并从头重跑;保留此 slug 作为旧 checkpoint 兼容入口。 Triggers: 继续试吃 / 恢复评测 / resume tasting / continue lobster...

Registry SourceRecently Updated
General

YiHui CONTEXT MODE

context-mode is an MCP server that saves 98% of your context window by sandboxing tool outputs. It routes large file reads, shell outputs, and web fetches th...

Registry SourceRecently Updated
General

xinyi-drink

Use when users ask about 新一好喝/新一咖啡 drinks, stores, menu, activities, Skill用户大礼包, today drink recommendations, afternoon tea, feeling sleepy, or personalized...

Registry SourceRecently Updated
General

vedic-destiny

吠陀命盘分析中文入口。用于完整命盘研判、命主盘 Rashi chart 与九分盘 Navamsha chart 联读、既往事件回看、出生时间稳定度判断、事业主题、婚姻主题、时空盘专题,以及基于 Jagannatha Hora PDF、星盘截图或文本命盘数据的系统拆盘。当用户提到完整星盘、事业方向、婚姻问题、关系窗...

Registry SourceRecently Updated