Stage 02 · Test · Researched comparison
Best SQL Code Generators in 2026
sqlc is the first pick for most teams that want type-safe code generated from plain SQL files, and it fits Go, Kotlin, Python and TypeScript projects. For Java and JVM shops that need a mature, heavily documented generator with commercial support, jOOQ is the alternative. TypeScript teams that prefer typed queries over a full ORM should look at PgTyped or kysely-codegen.
By Shihab Mia
Published 28 Nov 2026 · 7 tools compared
We run no ads and no affiliate links at launch. The order of a list follows our published method. See how we score.
Prices are the starting prices vendors list publicly. Plans change, so confirm the current price on the vendor page before you buy.
Key takeaways
- sqlc, PgTyped, kysely-codegen and sqlx are free and open source; jOOQ is open source for some databases but paid for others.
- Most of these tools read your schema and queries at build time, so generated code stays in sync with the database.
- Prisma uses its own schema file as the source of truth, while sqlc, PgTyped and sqlx start from SQL you already wrote.
- SQLDelight and sqlc generate code for multiple languages, but each targets different platforms and build systems.
Who each pick is for
- Go, Kotlin, Python and TypeScript teams writing plain SQLsqlc
- Java and JVM projects needing a mature SQL generator and query DSLjOOQ
- TypeScript projects on PostgreSQL that want typed SQLPgTyped
- TypeScript projects using Kysely that need generated table typeskysely-codegen
- Kotlin projects, including Android and multiplatform appsSQLDelight
- TypeScript and JavaScript teams that prefer a schema-first clientPrisma
- Rust projects that want compile-time checked SQL queriessqlx
Comparison
| Tool | Best for | Standout feature | Listed starting price | Free plan or trial |
|---|---|---|---|---|
| 1sqlc | Go, Kotlin, Python and TypeScript teams writing plain SQL | Generates typed code from ordinary SQL files | Free (open source) | Free plan |
| 2jOOQ | Java and JVM projects needing a mature SQL generator and query DSL | Generates Java classes from many database dialects | See vendor pricing page | Free trial (30 days) |
| 3PgTyped | TypeScript projects on PostgreSQL that want typed SQL | Generates TypeScript types from PostgreSQL queries | Free (open source) | Free plan |
| 4kysely-codegen | TypeScript projects using Kysely that need generated table types | Generates TypeScript interfaces from a live database | Free (open source) | Free plan |
| 5SQLDelight | Kotlin projects, including Android and multiplatform apps | Generates Kotlin from SQL files | Free (open source) | Free plan |
| 6Prisma | TypeScript and JavaScript teams that prefer a schema-first client | Generates a typed client from a schema file | See vendor pricing page | Free plan |
| 7sqlx | Rust projects that want compile-time checked SQL queries | Checks SQL against the database at compile time | Free (open source) | Free plan |
How we picked
We picked tools that generate typed code from SQL or a database schema and are currently maintained. Criteria were fit for the job, supported platforms and languages, price and licence, whether data stays local, and main limits. Sources are vendor pages, documentation and project repositories. Prices change, so confirm on the vendor site before you commit.
The tools, one by one
sqlc
Best for go, Kotlin, Python and TypeScript teams writing plain SQL

What it is and where it fits
sqlc reads your schema and annotated SQL queries, then generates type-safe functions and structs. It runs as a command-line tool and is configured with a sqlc.yaml file. Supported outputs include Go, Kotlin, Python and TypeScript. Because the input is standard SQL, the generated code matches what the database actually runs.
The project is open source under a permissive licence and is installed as a single binary. It works on macOS, Linux and Windows. There is no hosted service, so schema and queries stay on your machine or CI runner. The main limit is that it expects queries in files with specific comment annotations, and it does not generate a query builder. Teams that want dynamic query construction should look elsewhere.
Standout: Generates typed code from ordinary SQL files
Free (open source), as listed by the vendor (sqlc website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Generates typed code from ordinary SQL files
- supports multiple target languages
Drawbacks
- Requires a schema and query files in a fixed layout
- no runtime query builder
Skip it if this limit matters to you: requires a schema and query files in a fixed layout.
Verdict. A sensible pick for go, Kotlin, Python and TypeScript teams writing plain SQL.
Alternatives in this guide: jOOQ, PgTyped, kysely-codegen
jOOQ
Best for java and JVM projects needing a mature SQL generator and query DSL

What it is and where it fits
jOOQ generates Java code from your database schema and pairs it with a fluent SQL DSL. It supports a long list of databases, including PostgreSQL, MySQL, Oracle, SQL Server and others. The generator runs as a Maven or Gradle plugin, or from the command line, and produces classes that mirror your tables and columns.
The open-source edition covers some databases, while others require a commercial licence. Pricing depends on database, edition and support level, so check the vendor page. A free trial is offered. jOOQ is a good fit for JVM teams that want compile-time checked SQL and a rich DSL. Smaller projects or teams on a tight budget may find the licence cost hard to justify.
Standout: Generates Java classes from many database dialects
See vendor pricing page, as listed by the vendor (jOOQ website). Confirm the current plan price before you buy.
Free trial (30 days). Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Generates Java classes from many database dialects
- includes a full query DSL
Drawbacks
- Commercial licence required for several databases
- larger learning curve
Skip it if this limit matters to you: commercial licence required for several databases.
Verdict. A sensible pick for java and JVM projects needing a mature SQL generator and query DSL.
Alternatives in this guide: sqlc, PgTyped, kysely-codegen
PgTyped
Best for typeScript projects on PostgreSQL that want typed SQL

What it is and where it fits
PgTyped reads SQL files and a PostgreSQL schema, then generates TypeScript types and query functions. It runs as a command-line tool and integrates with the TypeScript build. Queries are checked against the live schema, so type errors show up before runtime.
The project is open source and free. It targets PostgreSQL only, which is a real limit for teams on other databases. It expects a running database or schema dump to introspect. Teams that want a single tool across several databases should skip it, but TypeScript teams already on PostgreSQL get a focused generator with little setup.
Standout: Generates TypeScript types from PostgreSQL queries
Free (open source), as listed by the vendor (PgTyped website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Generates TypeScript types from PostgreSQL queries
- works with existing SQL files
Drawbacks
- PostgreSQL only
- smaller community than larger projects
Skip it if this limit matters to you: postgreSQL only.
Verdict. A sensible pick for typeScript projects on PostgreSQL that want typed SQL.
Alternatives in this guide: sqlc, jOOQ, kysely-codegen
kysely-codegen
Best for typeScript projects using Kysely that need generated table types

What it is and where it fits
kysely-codegen introspects a database and writes TypeScript type definitions for the Kysely query builder. It supports PostgreSQL, MySQL, SQLite and other dialects through Kysely's dialect packages. You run it from the command line, and it can read from a live database or a schema file.
The tool is open source and free. Its job is narrow: it generates table and column types, not query functions. That keeps it simple but means you still write queries through Kysely. It suits teams already using Kysely. Teams that want generated query functions or support outside the Kysely ecosystem should choose a different tool.
Standout: Generates TypeScript interfaces from a live database
Free (open source), as listed by the vendor (kysely-codegen website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Generates TypeScript interfaces from a live database
- fits the Kysely query builder
Drawbacks
- Only produces types, not query functions
- tied to the Kysely ecosystem
Skip it if this limit matters to you: only produces types, not query functions.
Verdict. A sensible pick for typeScript projects using Kysely that need generated table types.
SQLDelight
Best for kotlin projects, including Android and multiplatform apps
What it is and where it fits
SQLDelight takes SQL files and generates Kotlin classes with typed query methods. It checks SQL against the schema at build time and reports errors in the IDE. It is used widely in Android and Kotlin Multiplatform projects and supports several database drivers.
The project is open source and free. It integrates through a Gradle plugin, so the build setup matters. It is Kotlin-only, which makes it a poor fit for mixed-language backends. For Kotlin teams that want SQL as the source of truth and typed access in code, it is a strong option.
Standout: Generates Kotlin from SQL files
Free (open source), as listed by the vendor (SQLDelight website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Generates Kotlin from SQL files
- supports Android and Kotlin Multiplatform
Drawbacks
- Kotlin-focused
- setup depends on the Gradle plugin
Skip it if this limit matters to you: kotlin-focused.
Verdict. A sensible pick for kotlin projects, including Android and multiplatform apps.
Prisma
Best for typeScript and JavaScript teams that prefer a schema-first client

What it is and where it fits
Prisma uses a schema file to define models, then generates a type-safe client for TypeScript and JavaScript. It also provides migration tooling. The open-source ORM and client are free. The company sells paid cloud products, so check the pricing page for those.
The generator runs from the command line and fits Node.js projects. It does not start from hand-written SQL, so teams with large existing SQL codebases may prefer sqlc or PgTyped. It is a good fit for application teams that want typed database access and migrations from one schema.
Standout: Generates a typed client from a schema file
See vendor pricing page, as listed by the vendor (Prisma website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Generates a typed client from a schema file
- good migration tooling
Drawbacks
- Schema file is the source of truth, not your SQL
- hosted features have paid tiers
Skip it if this limit matters to you: schema file is the source of truth, not your SQL.
Verdict. A sensible pick for typeScript and JavaScript teams that prefer a schema-first client.
sqlx
Best for rust projects that want compile-time checked SQL queries

What it is and where it fits
sqlx is a Rust database toolkit with macros that verify SQL queries at compile time. It supports PostgreSQL, MySQL and SQLite. The macros check queries against a live database during the build, or against cached metadata for offline builds.
The project is open source and free. It is Rust-only, so it does not help teams in other languages. The compile-time checking is the main draw, but it requires either a database at build time or a prepared offline cache. Rust teams that want typed queries without a full ORM should start here.
Standout: Checks SQL against the database at compile time
Free (open source), as listed by the vendor (sqlx website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Checks SQL against the database at compile time
- supports async runtimes
Drawbacks
- Rust only
- compile-time checks need a database connection or offline metadata
Skip it if this limit matters to you: rust only.
Verdict. A sensible pick for rust projects that want compile-time checked SQL queries.
Who should use what
Go teams writing plain SQL should start with sqlc. Java and JVM teams that need a full query DSL and commercial support should look at jOOQ. TypeScript teams on PostgreSQL can use PgTyped for typed queries, or kysely-codegen if they already use Kysely. Kotlin and Android teams should use SQLDelight. Rust teams that want compile-time checked SQL should use sqlx. Teams that prefer a schema-first client with migrations should consider Prisma.
Questions to settle before you buy
What to check before you buy
- Confirm the tool supports your database and target language.
- Check the licence and whether your database needs a paid edition.
- Verify how the generator gets the schema: live database, dump or schema file.
- Check that generated code fits your build system and CI pipeline.
- Confirm whether schema and queries leave your machine during generation.
FAQ
Do SQL code generators replace an ORM?
Not always. Some, like sqlc and PgTyped, generate typed functions from SQL and leave query writing to you. Others, like Prisma, include an ORM and migrations. Pick based on whether you want SQL as the source of truth or a schema-first client.
Are these tools free?
sqlc, PgTyped, kysely-codegen, SQLDelight and sqlx are free and open source. jOOQ is open source for some databases and paid for others. Prisma's ORM is free, with paid cloud products. Check each vendor page for current terms.
Can I use a generator with an existing database?
Yes. Most of these tools introspect an existing schema or read a schema dump. sqlc, PgTyped, kysely-codegen and jOOQ all work with existing databases. You add query files or configuration, then generate code.
Do these tools send my schema to a server?
The command-line tools run locally and read your schema from your machine or CI runner. Check configuration for any remote features. Avoid pasting schema dumps or credentials into third-party web pages, and prefer tools that run locally.
Which tool works with multiple languages?
sqlc generates code for Go, Kotlin, Python and TypeScript. jOOQ targets Java and the JVM. SQLDelight is Kotlin-only, Prisma is TypeScript and JavaScript, PgTyped and kysely-codegen are TypeScript, and sqlx is Rust.
Sources we checked
Method: how we score · editorial policy.
Change log. First published 28 Nov 2026.