Category guide · compile-only NL2SQL · schema contract
How to compile SQL from a schema contract
Give the compiler an allowlisted schema, not a live warehouse password. English becomes a closed Query IR, then parameterized SQL you run. The model never writes SELECT or ON.
What you upload
A JSON contract: tables, allow_columns, isolation, and declared join_paths. Recommended warehouse facts (indexes, enums, timezone, default_order) appear on the Validate checklist. Missing recommended fields do not invent columns — the matching improver is a no-op. Generate the JSON locally with PrismSchema 0.1.0 (pip install "prismschema==0.1.0"). PrismSchema does not compile SQL and does not send your DSN to InsightITS.
Retrieve is schema linking, not document RAG
Name-link
Exact table/alias hits, then short Levenshtein, then dense cosine on names. Cosine-only hits do not lock FROM.
Declared paths
Chunks are one document per table and per join_path. Ranking never invents a foreign key. Graphs are planted only from uploaded paths.
Restricted IR
Gemini sees only the retrieved tables and path ids. Manifest PEP still validates the full saved contract. ChorusGraph and PrismCortex are not on this path.
Compiler owns SQL
Ranges (last/next N days, over/under/between), prompt ORDER BY, and JWT isolation are injected in the compiler. Hosted response is sql_template + params, rows: [].
Call the hosted compiler
POST /api/prismsql/v1/query/execute
Authorization: Bearer <JWT>
{ "prompt": "invoices last 30 days over 500", "schema_id": "acme_orders" }
Success returns parameterized SQL. Unknown tables refuse SEMANTIC_UNSUPPORTED. Several numeric columns return status: clarify with candidates[] — the compiler does not pick the first column. You bind the template in the driver that already holds the warehouse credential.
Honest limits
| Claim | What the hosted API does |
|---|---|
| Chat with any database | No. Only tables on the uploaded contract. |
| Spider / BIRD leaderboard | Not published. Do not invent scores. |
| We run your SQL | Not on the public API. You run it. |
| PrismSQL is a pip package | No. Companion PrismSchema is Apache-2.0 on PyPI. |
Dashboard: /dashboard.html#prismsql. Pricing starts with a free sandbox, then Developer $49/mo.