一键导入
warehouse-sql
Review and run read-only natural-language SQL against a customer data warehouse with cached schema introspection and explicit write grants.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Review and run read-only natural-language SQL against a customer data warehouse with cached schema introspection and explicit write grants.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | warehouse-sql |
| description | Review and run read-only natural-language SQL against a customer data warehouse with cached schema introspection and explicit write grants. |
| user-invocable | true |
| requires | {"bins":["python3"]} |
| metadata | {"hybridclaw":{"category":"development","short_description":"Natural-language SQL for warehouses.","tags":["sql","warehouse","analytics","postgres","clickhouse","bigquery","snowflake"]}} |
Use this skill when the user asks natural-language questions of a data warehouse, analytics database, or TPC-H-style reporting dataset.
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json schema --backend sqlite --database ./warehouse.db
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json review "SELECT c_name FROM customer LIMIT 10"
For review-only commands, pass --model-review with the original question
to invoke HybridClaw's OpenAI-compatible gateway for the business-meaning
review:
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json review --model-review --question "Show the first 10 customers" "SELECT c_name FROM customer LIMIT 10"
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json query --backend sqlite --database ./warehouse.db --execute --question "Show the first 10 customers" "SELECT c_name FROM customer LIMIT 10"
query --execute always invokes model review before running SQL. Configure
model review with HYBRIDCLAW_GATEWAY_URL / GATEWAY_BASE_URL and
HYBRIDCLAW_WAREHOUSE_SQL_MODEL_REVIEW_TOKEN, HYBRIDCLAW_GATEWAY_TOKEN, or
GATEWAY_API_TOKEN. Execution requires --question so the model can check
whether the SQL answers the user's request.Supported backend names:
sqlite — executable through Python stdlib; used by the bundled eval suitepostgres — psycopg driver, or a connector commandclickhouse — clickhouse-connect driver, or a connector commandbigquery — google-cloud-bigquery driver, or a connector commandsnowflake — snowflake-connector-python driver, or a connector commandFor non-SQLite warehouses, install the backend driver package in the skill
runtime or provide --backend-command / HYBRIDCLAW_WAREHOUSE_SQL_<BACKEND>_COMMAND.
Connector commands read SQL on stdin and emit a JSON row array, {"rows": [...]}
or CSV with headers. Do not invent credentials.
BigQuery schema introspection requires --bigquery-dataset or
HYBRIDCLAW_WAREHOUSE_SQL_BIGQUERY_DATASET. Set
--bigquery-project / HYBRIDCLAW_WAREHOUSE_SQL_BIGQUERY_PROJECT when the
dataset is not in the default project.
The helper writes schema cache files outside the repo by default at:
~/.hybridclaw/warehouse-sql/schema-cache
Use --cache-dir for tests or customer-specific workspaces. Use --refresh to
force re-introspection. Use schedule-refresh to register the refresh with the
HybridClaw gateway scheduler:
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json schedule-refresh --backend postgres --profile analytics --every "0 */6 * * *"
Scheduled refreshes default to last-channel delivery. Use
--delivery-kind channel --delivery-to <channel-id> only when the target
channel id is known.
Set HYBRIDCLAW_GATEWAY_TOKEN or GATEWAY_API_TOKEN in the environment for
production scheduler registration. --gateway-token is supported for tests, but
tokens passed as CLI arguments can be visible in process listings.
SELECT, WITH, and EXPLAIN are allowed.--allow-writeHYBRIDCLAW_WAREHOUSE_SQL_WRITE_GRANT--write-grant exactly matches that environment valueBefore execution, check:
LIMIT is present for exploratory row readsThe helper emits a review object with safety status and findings. Treat that
as a deterministic guardrail. Pass --model-review on review-only commands to
have the helper invoke the configured OpenAI-compatible model endpoint and add
that verdict to review.modelReview; query --execute invokes model review
automatically. Execution is blocked unless both the deterministic guardrail and
model review pass.
Model review defaults to HYBRIDCLAW_GATEWAY_URL / GATEWAY_BASE_URL plus
/v1/chat/completions and model auxiliary/eval_judge, with authentication from
HYBRIDCLAW_WAREHOUSE_SQL_MODEL_REVIEW_TOKEN, HYBRIDCLAW_GATEWAY_TOKEN, or
GATEWAY_API_TOKEN. Use --model-review-url, --model-review-model,
--schema-cache, and --question to make the review explicit in tests or
operator workflows.
Run the offline TPC-H-style scenarios:
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json eval-scenarios
The fixture at evals/tpch_tiny.sql contains a tiny public-schema-compatible
dataset using TPC-H-style tables (customer, orders, lineitem, supplier,
part, nation). It is an offline deterministic fixture for SQL generation
coverage, not a TPC-H benchmark run. The scenario file at
evals/tpch_scenarios.json verifies read-only review and execution against
deterministic answers.
To measure model SQL generation against the same deterministic fixture, run the model-backed planner:
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json eval-scenarios --model-planner --model-review-model gpt-5
Use --scenario-id <id> to isolate one scenario while iterating.
Run:
python3 skills/skill-creator/scripts/quick_validate.py skills/warehouse-sql
python3 skills/warehouse-sql/scripts/warehouse_sql.py --help
python3 skills/warehouse-sql/scripts/warehouse_sql.py --format json eval-scenarios
Work with Lexware Office contacts, products, invoices, quotations, bookkeeping vouchers, receipts, payment status, and guarded invoice, quotation, or expense writes through the Public API.
Search Airtable bases and tables, read records and computed fields, and prepare guarded record CRUD requests with schema-based field validation.
Expose HybridClaw as a custom Alexa skill and prepare guarded Alexa smart-home/device control payloads without exposing Amazon credentials.
Read Blink camera and video-doorbell state, list motion clips, and prepare guarded home-security control requests without exposing Blink credentials.
Read BYD Battery-Box HVS/HVM/LVS/LVL home-storage telemetry through local Modbus or paired-inverter delegation, with read-only safety boundaries.
Harvest monthly SaaS billing invoices into normalized records and official PDF files.