Skip to content

Typed SQL in other languages

Most languages have a tool that types raw SQL. They split into two families. Tools that ask a live database at build time get exact types but need the database wherever they build. Tools that read the schema, like SQLTy, work offline. The table covers the ones listed in SQLTy's prior art. None was run hands-on, so every fact comes from the project's own README or docs.

Tool Language Queries live in Types from Database needed to build Databases
jOOQ Java Java DSL (plain SQL templates too) Classes generated from database metadata Not stated 30+
SQLDelight Kotlin Labeled SQL statements Your CREATE TABLE schema; verifies schema, statements and migrations at compile time Not stated; types come from the schema files SQLite, MySQL, PostgreSQL; H2 experimental
doobie Scala sql"..." interpolation Opt-in check in tests Yes, for check Any JDBC; PostgreSQL and H2 add-ons
postgresql-typed Haskell [pgSQL\|...\|] quasi-quotes Template Haskell asks the database at compile time Yes PostgreSQL
Cornucopia Rust .sql files with --! names Prepares queries on a database Yes PostgreSQL
Squirrel Gleam One query per .sql file Connects to PostgreSQL Yes PostgreSQL 16+
SQLTy Python; Go in preview Inline strings, .sql query files Your CREATE TABLE files and migrations No PostgreSQL, MySQL, SQLite

What they share with SQLTy

  • SQLDelight is the closest in design: schema files are the source of truth, and statements and migrations are verified at compile time. It generates Kotlin APIs, where SQLTy checks the row types you write.
  • doobie's check reports the same classes of mistake SQLTy reports, nullability, arity and type coercion, but at test time with a database. Its docs call out outer-join columns as a weak case and poor metadata on MySQL and MS SQL.
  • Squirrel documents that PostgreSQL doesn't report parameter nullability. A prepared query doesn't report result nullability either, which is why PgTyped and Prisma TypedSQL get LEFT JOIN columns wrong.

When to look elsewhere

If you write Java, Kotlin, Scala, Haskell, Rust or Gleam, use your language's tool. SQLTy checks Python, and Go in preview.

Common questions

Does SQLTy check Java, Kotlin or Rust code?

No. SQLTy checks Python, and Go in preview. Rust support is tracked in #855.

Sources

READMEs and docs, read 2026-12-01: jooq.org; sqldelight.github.io (2.4.1); typelevel.org/doobie (1.0.0-RC14, "Checking" chapter); Hackage postgresql-typed 0.6.2.7 (2026-08-21); cornucopia-rs.github.io; squirrel.hexdocs.pm (4.7.0).