sqlc
sqlc generates fully type-safe, idiomatic code from SQL queries, eliminating boilerplate database access code and catching schema errors before they reach production.
At a Glance
Fully free and open-source under the MIT License. Download and use without restrictions.
Engagement
Available On
Alternatives
Listed May 2026
About sqlc
sqlc is an open-source SQL compiler that takes your SQL queries and generates type-safe code in Go, Kotlin, Python, or TypeScript. Created by Kyle Conroy and maintained under the sqlc-dev GitHub organization, it is licensed under the MIT License and available as a CLI tool for Linux, macOS, and Windows. The project has accumulated over 17,700 GitHub stars and is actively maintained, with the latest release being v1.31.1 published in April 2026.
What It Is
sqlc sits in the database access layer of an application stack. Instead of writing repetitive boilerplate to query a database and map results to typed structs or objects, developers write plain SQL and run sqlc generate to produce idiomatic, type-safe interfaces. The workflow is: write SQL queries → run sqlc → call the generated methods from application code. This approach keeps SQL as the source of truth while giving the compiler-level safety of a typed language.
How the Workflow Works
The core loop is straightforward:
- Write SQL schema migrations and queries in
.sqlfiles. - Configure sqlc via a
sqlc.yamlfile specifying the target language, database engine, and output paths. - Run
sqlc generateto produce code with typed structs and method signatures matching each query. - Call the generated methods directly from application code — no manual scanning, no reflection-based ORM magic.
The generated code is plain, readable source code that can be committed to version control and reviewed like any other code.
Schema Verification with sqlc verify
A notable feature introduced in v1.24.0 is sqlc verify, which analyzes existing queries against proposed schema changes and reports errors before the schema change is applied to a production database. The project homepage describes this as a safeguard against schema updates and poorly-written queries that "often bring down production databases." This makes sqlc useful not just at code-generation time but also as a CI check during schema migrations.
Language and Database Support
sqlc supports multiple target languages through official and community plugins:
- Go via
sqlc-gen-go - Kotlin via
sqlc-gen-kotlin - Python via
sqlc-gen-python - TypeScript via
sqlc-gen-typescript
Supported database engines include PostgreSQL, MySQL, and SQLite. Additional language targets can be added through the plugin system documented in the official docs.
Update: v1.31.1 and Recent Releases
The latest release is v1.31.1, published on April 22, 2026. Recent notable releases include:
- v1.27.0 (August 2024): Added support for local managed databases for any PostgreSQL server.
- v1.26.0 (March 2024): Primarily a bug fix and security fix release.
- v1.25.0 (January 2024): Removed the cgo dependency, simplifying cross-compilation and distribution.
The project is actively maintained with regular releases and an open issue tracker, signaling continued development momentum.
Community Discussions
Be the first to start a conversation about sqlc
Share your experience with sqlc, ask questions, or help others learn from your insights.
Pricing
Open Source
Fully free and open-source under the MIT License. Download and use without restrictions.
- Type-safe code generation from SQL
- Go, Kotlin, Python, TypeScript support
- PostgreSQL, MySQL, SQLite support
- sqlc verify for schema change validation
- Plugin system for community languages
Capabilities
Key Features
- Generates type-safe code from SQL queries
- Supports Go, Kotlin, Python, and TypeScript code generation
- Works with PostgreSQL, MySQL, and SQLite
- sqlc verify catches schema change errors before production
- Plugin system for community language support
- CLI tool for Linux, macOS, and Windows
- No boilerplate SQL querying code required
- Idiomatic generated code committable to version control
- Local managed database support (v1.27.0+)
- Interactive playground at play.sqlc.dev
