Trustable SQL: assembled and checked in your editor
The Problem
Build on your tables and columns. Check queries automatically before they ship. Keep your stack unchanged.
DBQC keeps SQL's relational foundation while turning query logic into a first-class, composable program: use discovered table and column definitions to write it in application code, validate it before execution, and compile it to SQL for the database you target. The result is ordinary SQL—not a runtime black box—plus ordered parameters and a result schema: a deterministic artifact your team can inspect, test, commit, diff in CI, and review in a pull request.
That foundation enables composable query components, cross-vendor SQL generation, stronger compiler validation, testable query artifacts, and editor feedback. DBQC can compare two query definitions to establish equivalence or show a counterexample. It can also disassemble an existing SQL statement into a DBQC definition as an explicit migration step, so a legacy query can enter the same discovery, validation, compilation, and review workflow.
The result is a different operating model for database code: safer changes, faster development, and a credible path to migrate without repeatedly rewriting every query.
Start with Who DBQC Is For to choose the story that matches your team: composable application query logic, database portability and modernization, or a large query estate.
What DBQC Does
DBQC lets you define queries as structured, typed data. Start by discovering the tables, columns, and types in the database you have. Then describe filters, joins, aggregates, and DML operations explicitly, as you would in a strong fluent SQL API. The compiler validates that definition and emits SQL for your target dialect.
You describe WHAT you want. The compiler handles the rest — dependency resolution, parameter numbering, and schema validation.
Discovered schema → DBQC query definition
(JSON / Python / TypeScript / Java / Rust / Scala)
↓
DBQC compiler validation
↓
Emitted SQL + ordered parameters + result schema
↓
Your existing driver, pool, and transaction boundary

A better feedback loop for query code
DBQC connects the work of defining a query to the evidence needed to ship it. In VS Code, discovered schema provides table and column context; the DBQC compiler supplies diagnostics and a preview of the emitted SQL. The same definition can be checked in CI, golden-tested as emitted SQL, or compared with a refactor. When it is time to run, the application sends the ordinary SQL and ordered parameters through its existing driver, pool, and transaction boundary.
DBQC therefore improves the feedback around execution without taking ownership of execution itself. See VS Code Integration, CI / CD, and Query Comparison for the complete workflow.
Query Safety
DBQC's primary job is to compile composable query definitions into validated SQL. As part of that compilation, it checks query structure and schema use before SQL reaches the database.
DBQC currently provides 28 query-safety checks: 8 errors that block compilation and 20 warnings for risky but legal SQL. They catch issues such as invalid null comparisons, unsafe joins, ungrouped aggregates, and unfiltered writes early—while a developer or CI job can act on them. That removes repeatable review work from the database team's path, leaving more time for the judgment-heavy work: schema design, indexes, execution plans, and capacity.
See Query Safety for the complete comparison and every check.
Query Comparison
After a query passes DBQC's safety checks, you can compare it with another query definition. This is useful when reviewing a refactor, changing a generated query, or checking whether two implementations preserve the same result.
The comparator can prove that the queries are equivalent, return a concrete synthetic database that makes their results differ, or report that the available rules cannot decide. It never treats a failed search for differences as proof of equivalence.
See Query Comparison for API usage, response examples, counterexamples, and current limitations.
Pricing That Reflects the Work
DBQC charges for a compilation attempt, not for a database response or every runtime execution. A successful compile produces reusable SQL; an unsuccessful one produces diagnostics that stop a real query problem before production. Both are useful compiler work. Each API key therefore has its own daily operation allocation, while Team and Business plans give multiple people or services independently allocated keys.
Standard dialects are available on DBQC plans. Oracle, SQL Server, and DB2 require DBQC Pro, which begins at the Plus-level individual allocation. Eligible nonprofits and first-year startups receive a one-step individual-tier upgrade: Free becomes Basic, Basic becomes Standard, and Standard becomes Plus. See pricing and the introductory-renewal terms.
The Free plan provides a 30-day commercial evaluation. Personal and nonprofit use has no time limit, in either case within the Free plan's daily allocation.
Key Features
Composability
Define a query fragment once. Use it in any query. The compiler resolves dependencies automatically.
An "active users" filter, a "user milestone update," a "monthly revenue aggregate" — each is a standalone fragment. Plug any of them into any query. The compiler resolves dependencies automatically and eliminates duplication.
DML in the Query Graph
UPDATE, INSERT, and DELETE operations are nodes in the DAG, not separate statements. An UPDATE with RETURNING produces a result set that downstream nodes can filter, join, or aggregate against — all in a single compiled query.
This means "update the user's milestone, then return the full profile joined with their loan data" is one query, not two roundtrips.
Schema Validation
Every node declares its output schema. The compiler validates that column references exist, types match, and set operations have compatible schemas — before any SQL reaches the database.
With TypedTable, column references are checked at compile time. Rename a column in the table definition and every query that references it fails at build time, not in production.
Null-Safe Equality
= in SQL is broken: NULL = NULL is NULL, not TRUE. DBQC uses IS NOT DISTINCT FROM for equality by default. Two NULLs compare as equal. No more silent bugs from null comparisons.
Total Quoting
Every identifier is double-quoted. No keyword collisions. No case sensitivity surprises. "user", "order", "group" — all safe.
Explicit Casting
Every literal and parameter is cast to its target type. $1::uuid, 'active'::text (PostgreSQL); CAST(? AS CHAR(36)) (MySQL). No implicit type coercion. The database knows exactly what types it's working with.
When query composition becomes manual plumbing

Before: a manually assembled workflow
def set_user_milestone(user_str, milestone_str):
return f"""
UPDATE user_profiles
SET watermark = GREATEST(watermark, milestone, {milestone_str}),
milestone = {milestone_str}
WHERE user_id = {user_str}
RETURNING *
"""
# Caller 1
query = f"""
WITH params AS (...),
profile AS ({set_user_milestone("params.user_id", "params.milestone")})
SELECT * FROM profile JOIN loans ON ...
"""
# Caller 2 — same fragment, different context
query = f"""
WITH params AS (...),
profile AS ({set_user_milestone("params.user_id", "'M4'")})
SELECT * FROM profile JOIN comparisons ON ...
"""
Problems:
- Column renames break silently at runtime
- Dependency ordering is manual and error-prone
- Parameter positions are managed by hand
- No validation until the query hits the database
- The fragment can't be tested in isolation
After: DBQC
{
"type": "Update",
"table": {"type": "Table", "name": "user_profiles", "heading": {"..."}},
"sets": {
"watermark": {"expr": "FuncExpr", "name": "GREATEST", "args": ["...watermark, milestone, param..."], "type": "text"},
"milestone": {"expr": "ColRef", "source": "params", "name": "milestone", "type": "text"}
},
"where": {"expr": "BinaryExpr", "left": "...user_id...", "op": "Eq", "right": "...param_user_id...", "type": "bool"},
"returning": ["id", "name", "milestone", "watermark"]
}
Define it once. Reference it from any query. The compiler validates column references, resolves dependencies, numbers parameters, and catches schema mismatches — all before any SQL reaches the database.
What DBQC Does NOT Do
Query optimization. DBQC generates correct SQL. It does not rewrite queries for performance. Your database's query planner handles that. If you need filter pushdown or join reordering, that's the database's job.
Execution ownership. DBQC does not open a connection, manage a pool, begin or commit a transaction, retry a query, or replace your result handling. It produces SQL strings and parameter metadata for the tools that already do that work in your application.
ORM features. No object mapping, no lazy loading, no change tracking, and no migrations. DBQC is a query compiler, not an ORM.
Schema management. DBQC can emit CREATE TABLE DDL, but it's not a migration tool. Use your existing migration framework.
Every SQL feature. Arrays and JSON path queries are not yet supported. RawSource and RawExpr provide escape hatches for parts of a DBQC definition that the algebra does not yet model.
Not every database. DBQC supports PostgreSQL, MySQL, SQLite, and DuckDB via dialect-specific emitters. Oracle, SQL Server, and DB2 are available with DBQC Pro. Other databases are not yet supported.
Adoption questions
Before a production decision, teams reasonably ask what reaches the compiler, whether credentials or execution move, how availability affects their workflow, and what DBQC does not validate. Read the Adoption FAQ for direct answers, then use the pilot to test one real query without a broad rewrite.
When to Use DBQC
- You have query fragments reused across multiple repositories
- You build complex queries with multiple interdependent parts
- You want to catch column reference errors before runtime
- You need DML operations (UPDATE/INSERT/DELETE) whose results feed into subsequent queries
- You're tired of manually managing query ordering and parameter positions
When Not to Use DBQC
- Simple CRUD with an ORM (use the ORM)
- One-off ad hoc queries (use raw SQL)
- You need heavy JSON processing (DBQC doesn't cover JSON path queries yet)
- Your query layer is small, stays in one runtime, and your current tooling
already provides the validation and testing feedback you need