DBQC vs SQLAlchemy
SQLAlchemy is a Python runtime ORM. DBQC is a multi-language SQL compiler. They solve different problems at different layers, and the distinction matters more than any feature comparison.
SQLAlchemy connects to your database and executes queries. DBQC compiles query definitions into SQL strings — it never touches your database. DBQC focuses on the feedback before that handoff: editor assistance, diagnostics, tests, and reviewable SQL. SQLAlchemy's multi-dialect support is runtime-only, in one language. DBQC's is compile-time, across five languages.
For simple queries in a Python app, SQLAlchemy is great. When your queries span languages, need compile-time validation, or demand composability that a runtime ORM can't offer, DBQC is built for that.

The Core Difference
In SQLAlchemy you chain Python methods to build a statement and decide how the pieces nest. In DBQC you declare query nodes as values — in Python, Java, Scala, Rust, or TypeScript — reference them from each other, and the compiler resolves the whole graph: CTE ordering, deduplication, parameter indexing, dialect-specific SQL. One compile call, one SQL string, no database connection required. Almost every difference below follows from that.
Where DBQC Is Different
Runtime library vs compile-time service
SQLAlchemy runs inside your Python process. It connects to your database, builds queries at runtime, executes them, and maps results back to Python objects. If something is wrong with your query, you find out when it runs.
DBQC is a compiler. You define queries as data — in any of five languages — send them to the DBQC service, and get back validated SQL strings, ordered parameter lists, and typed result schemas. DBQC has no database connection or execution role. A malformed query fails before production, and the resulting SQL continues through whatever driver, pool, and transaction handling you already use.
This is the fundamental distinction. Everything else flows from it.
Five languages, seven dialects
SQLAlchemy is Python-only. If your backend is Java, Scala, Rust, or TypeScript, SQLAlchemy is not an option.
DBQC supports Python, Java, Scala, Rust, and TypeScript — plus a raw JSON wire format for any language with an HTTP client. The same query model, the same compiler, the same SQL output. A Python data team and a Rust backend team can share query definitions and get identical compiled SQL.
The compiler emits SQL for seven dialects: PostgreSQL, MySQL, SQLite, and DuckDB as standard, plus Oracle, SQL Server, and DB2 via DBQC Pro. Through wire compatibility, those seven cover 90%+ of application databases: Aurora, AlloyDB, Supabase, Neon, CockroachDB (Postgres wire); MariaDB, TiDB, PlanetScale, Vitess (MySQL wire); Turso, D1, libSQL (SQLite wire). One query definition, any of these databases.
SQLAlchemy supports multiple dialects too — but only from Python, only at runtime, and only when connected to the target database.
Whole-query DAG with automatic CTE resolution
In SQLAlchemy, CTEs exist but you wire them together by hand:
active = select(users).where(users.c.status == "active").cte("active")
stats = select(func.count()).select_from(active).cte("stats")
query = select(active, stats) # you decide the nesting and ordering
Reference active from two branches and SQLAlchemy may inline it twice as separate subqueries. In DBQC, a node referenced from ten places becomes exactly one CTE — deduplicated by identity — and the compiler topologically sorts every node so the WITH clause is always ordered correctly. You never hand-order CTEs.
DML as composable nodes
SQLAlchemy can express a data-modifying CTE — update(...).returning(...).cte() feeding a SELECT — but you assemble that wiring by hand for every query. DBQC models INSERT, UPDATE, and DELETE as graph nodes: an UPDATE ... RETURNING is a value whose output schema flows into downstream joins, filters, and aggregates, and the compiler folds the whole thing into one atomic WITH ... UPDATE ... RETURNING ... SELECT. Define it once, reuse it anywhere — mutate-then-read is a single round trip and a single node, not reassembled each time.
Fragments are typed values you reuse and version
A DBQC fragment is an ordinary value — a Python Source, a Rust struct, a TypeScript object, or its raw JSON. It declares its own output schema, carries its own dependencies, and is testable on its own. Define a filter once and reference it everywhere; change it and that's one diff with a clear blast radius. And because it's just a value checked into your repo, every fragment has full git history — diff how a query's logic changed, git blame a WHERE clause, review query changes in a pull request, all with the tooling you already use.
Compile-time error checking in all five languages
SQLAlchemy validates column references against table metadata at construction time, in Python, at runtime. DBQC validates the entire query graph before any SQL is produced — column existence, type agreement across every node, schema compatibility — and this works in all five client languages, not just one. A renamed column, a type mismatch, a missing join — the compiler catches it before your code ever runs. In CI, this becomes a build gate: compile all queries, fail the build on any error, ship with confidence.
The compiler binds and numbers every parameter and quotes every identifier, so malformed or injectable SQL is not something you can produce by hand. Equality defaults to IS NOT DISTINCT FROM, so NULL handling is correct by default instead of something you remember to opt into.
TypedQuery: typed result mapping in all five languages
SQLAlchemy maps query results to Python objects through its ORM layer. Outside of the ORM, you get raw rows.
DBQC's TypedQuery gives you typed result mapping in every client language — Python, Java, Scala, Rust, and TypeScript. The compiler returns the result row schema alongside the SQL, so your client knows the exact types coming back. No ORM required, no code generation step, no runtime reflection. The types flow from your query definition through compilation to your result handling.
VS Code extension
SQLAlchemy has no IDE extension. You write query expressions in Python and hope you got the column names right.
DBQC ships a VS Code extension with schema-aware autocomplete, CodeLens for inline query previews, hover documentation, and real-time diagnostics. Your editor knows your schema and catches errors as you type — across all five client languages. The previewed SQL still runs through the execution layer you choose. See VS Code Integration.
CI-diffable SQL
Because DBQC compiles queries to SQL strings deterministically, you can compile every query in CI and diff the output between commits. Refactor a fragment, and the CI diff shows you exactly which SQL statements changed and how. This is not possible with SQLAlchemy — there is no compile step, no deterministic SQL artifact, and no way to diff query changes independently of the code that builds them.
Readable SQL you can test without a database
compile() is a pure function: no connection, no session — the graph goes in, and out come the SQL string, the ordered parameter list, and the result row schema. The SQL is a flat chain of named CTEs in dependency order, not nested-subquery soup, so it reads top to bottom. SQLAlchemy can stringify a statement, but it renders against a bound engine near execution; DBQC's whole artifact is the output of a pure, offline function — so you can golden-test the exact SQL a fragment produces in a unit test, with no database in the loop.
Schema discovery without codegen
DBQC includes dbqc_discover.py — point it at a live database and it fetches your schema into portable definitions the compiler understands. No codegen build step, no ORM model synchronization, no manual table definitions. SQLAlchemy can reflect schemas too, but only at runtime, only in Python, and the result is Python objects tied to a connection. DBQC's discovery produces portable schema definitions usable from any client language.
Your queries are data
Because a query is a typed value — a DAG you can inspect and transform — you can do things opaque SQL strings cannot: inject an org or tenant filter into every read from one place, statically find every query that references a column or writes a table (for an audit or a safe rename), or rewrite queries programmatically. SQLAlchemy expressions are introspectable Python objects, but DBQC's portable, typed, whole-query DAG is built for this kind of cross-language analysis.
Where SQLAlchemy Fits Better
It executes. SQLAlchemy runs queries, maps results, and manages connections, pooling, transactions, and sessions. DBQC produces SQL and a row schema; execution is your driver's job.
It has an ORM. Identity maps, lazy loading, change tracking, relationships. DBQC is a query compiler, with no object-mapping layer.
Bigger feature surface. Recursive CTEs, LATERAL joins, array and JSON operators, window frame clauses, and many engine-specific constructs are first-class in SQLAlchemy. DBQC covers the common surface and provides RawSource/RawExpr escape hatches for the rest.
Maturity. 18+ years, battle-tested, massive ecosystem. SQLAlchemy is the standard Python database toolkit for good reason.
Database Reach
Seven SQL dialect emitters — PostgreSQL, MySQL, SQLite, DuckDB (standard) plus Oracle, SQL Server, and DB2 (DBQC Pro) — covering the engines most teams actually run. Through wire compatibility, practical reach extends further: Aurora, AlloyDB, Supabase, Neon, CockroachDB speak the Postgres wire protocol; MariaDB, TiDB, PlanetScale, Vitess speak MySQL; Turso, D1, libSQL speak SQLite. Seven dialects, 90%+ of application databases covered.
SQLAlchemy supports multiple dialects too, but its dialect support is runtime-only and Python-only. DBQC's dialect coverage is compile-time and language-independent — the same query compiled for Postgres from Python produces the same SQL as the same query compiled for Postgres from Rust.
Pricing
DBQC charges per compilation attempt, not per execution. Compile a query once, then execute that generated SQL in production, on every replica, and across every instance without DBQC runtime metering. Attempts that return diagnostics count as operations because catching an invalid query before it runs is useful compiler work.
The Free plan supports a 30-day commercial evaluation; personal and nonprofit use has no time limit within the Free daily allocation.
| Tier | Introductory price | Operations / key / day | Keys |
|---|---|---|---|
| Free | $0/yr | 10 | 1 |
| Basic | $99/yr | 30 | 1 |
| Standard | $199/yr | 100 | 1 |
| Plus | $499/yr | 300 | 1 |
| Team | $1,999/yr | 1,000/key | 5 |
| Business | $9,999/yr | 2,000/key | 25 |
Each key has its own allocation; Team and Business capacity is not a shared pool. DBQC Pro is required for Oracle, SQL Server, and DB2, starts at the Plus-equivalent individual allocation, and runs from $749/yr to $14,999/yr at introductory pricing. Eligible nonprofits and first-year startups receive a one-step individual-tier upgrade: Free becomes Basic, Basic becomes Standard, and Standard becomes Plus. Full pricing and renewal terms.
SQLAlchemy is open source and free. The trade-off is clear: SQLAlchemy costs nothing and does everything in Python. DBQC costs money and does one thing — compile SQL — across five languages and seven dialects with compile-time guarantees SQLAlchemy cannot provide.
Summary
| Capability | SQLAlchemy | DBQC |
|---|---|---|
| What it is | Python runtime ORM + query builder | Multi-language SQL compiler |
| Connects to your database | Yes | No (compiles to SQL strings) |
| Languages | Python | Python, Java, Scala, Rust, TypeScript |
| Target dialects | Many (runtime, Python-only) | 7 (compile-time, any language) |
| Wire-compatible databases | N/A (connects directly) | 90%+ of app databases via 7 dialects |
| Typed query construction | Yes | Yes |
| Typed result mapping | ORM layer (Python) | TypedQuery (all 5 languages) |
| CTE support | Manual | Automatic (DAG) |
| Shared subexpression dedup | No | Yes (by identity) |
| DML feeding downstream query | Manual (data-modifying CTE) | Composed node, single statement |
| Compile-time error checking | No (runtime validation) | Yes (all 5 languages, CI build gate) |
| Null-safe equality default | No | Yes |
| Compiled SQL as testable artifact | Rendered near execution | Pure function (SQL + params + schema) |
| CI-diffable SQL | No | Yes |
| VS Code extension | No | Schema-aware autocomplete, CodeLens, diagnostics |
| Schema discovery | Runtime reflection (Python) | dbqc_discover.py (portable defs) |
| Queries as analyzable data | Python objects | Portable typed DAG |
| Fragments versioned in git | As code | As self-contained typed values |
| ORM | Yes | No |
| Execution / connection mgmt | Yes | No |
| Maturity | 18+ years | Newer |
Choosing
SQLAlchemy when you want an ORM, built-in execution and connection management, or a battle-tested Python database toolkit with 18 years of ecosystem behind it.
DBQC when you need compile-time query validation across multiple languages, composable fragments with automatic CTE resolution and deduplication, typed results without an ORM, CI-diffable SQL artifacts, IDE support with schema-aware autocomplete, and one query model that compiles to seven SQL dialects from five languages — covering PostgreSQL, MySQL, SQLite, DuckDB, and with DBQC Pro, Oracle, SQL Server, and DB2.