Overview
sqlc has been developed since 2019, mainly by Kyle Conroy. The workflow is three steps: write queries in .sql files with a name annotation (for example -- name: GetAuthor :one), run sqlc generate, and call the generated Go methods. sqlc parses your CREATE TABLE and ALTER TABLE statements, so the generated structs and parameters match your schema, and invalid queries fail at generate time.
Go support for PostgreSQL and MySQL is stable and SQLite is beta. Official plugins generate Kotlin, Python and TypeScript (beta), and community plugins add C#, Java, Ruby, Rust (sqlx), F#, Zig and others. sqlc can also check queries against a live database with its analyzer.
sqlc does not run migrations. Point it at a migration directory from Atlas, dbmate, golang-migrate, goose, sql-migrate or tern and it will read the up migrations to learn the schema. Releases continue in 2026, with v1.31.0 and v1.31.1 in April.
Pricing and plans
| Plan | Price | What you get |
|---|---|---|
| sqlc | $0 | MIT licence; funded by GitHub sponsors |
What it does
- Compile-time checked SQL
- Queries are parsed against your schema; mistakes fail during sqlc generate, not in production.
- Idiomatic generated Go
- Plain structs and methods over database/sql or pgx, with no runtime dependency on sqlc.
- Language plugins
- Official Kotlin, Python and TypeScript generators plus community plugins for C#, Java, Ruby, Rust and more.
- Migration-aware
- Reads schemas from Atlas, dbmate, golang-migrate, goose, sql-migrate and tern migration folders, ignoring down files.
- Query annotations
- :one, :many, :exec, :copyfrom and batch annotations control the generated method shapes.
Strengths and limitations
Strengths
- You write and review real SQL; no ORM query language to learn
- Zero runtime overhead beyond the database driver
- Errors caught at build time
- Works well with any migration tool
Limitations
- Dynamic queries (optional filters, variable ORDER BY) are awkward because each query is fixed SQL
- SQLite support for Go is still beta; Kotlin, Python and TypeScript plugins are beta
- No relation loading or object graph; you write the joins yourself
- No migration runner; you need a separate tool
Who it suits
Good for
- Go services on PostgreSQL or MySQL
- Teams that want SQL reviewed like any other code
- Performance-sensitive backends
Look elsewhere if
- Apps with many dynamic, user-built filters
- Developers who prefer not to write SQL
Alternatives to sqlc
| Tool | From | Free option | Stages |
|---|---|---|---|
| Kysely Type-safe TypeScript SQL query builder | — | ||
| Eloquent ORM Active Record ORM for Laravel | — | ||
| SQLAlchemy Python SQL toolkit and ORM | — | ||
| Active Record (Rails) Active Record ORM for Ruby on Rails | — | ||
| Prisma ORM Schema-first TypeScript ORM | $10/mo | Free tier | |
| Bun (Go ORM) SQL-first Go ORM | — |
Questions
Is sqlc an ORM?
No. It is a compiler that generates type-safe code from SQL you write; there is no runtime ORM layer.
Does sqlc run migrations?
No. It reads schema from migration files made by tools such as goose, golang-migrate or Atlas, which you use to apply them.
Which languages does sqlc support?
Go is built in; official plugins cover Kotlin, Python and TypeScript, and community plugins add C#, Java, Ruby, Rust and others.
Sources read for this page