sqlc
sqlc is a code generator that takes SQL queries and produces type-safe code interfaces in multiple languages (Go, Python, Kotlin, TypeScript). It bridges SQL and application code by parsing queries and generating strongly-typed functions, eliminating manual query wrapper boilerplate.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | sqlc-dev/sqlc |
| Owner | sqlc-dev |
| Primary language | Go |
| License | MIT — OSI-approved |
| Stars | 18k |
| Forks | 1.1k |
| Open issues | 703 |
| Latest release | v1.31.1 (2026-04-22) |
| Last updated | 2026-07-08 |
| Source | https://github.com/sqlc-dev/sqlc |
What sqlc is
sqlc parses SQL queries against a target database schema and generates language-specific, type-safe function signatures with compile-time validation. It supports PostgreSQL, MySQL, and SQLite, with pluggable language backends via WASM plugins, enabling type checking at code generation time rather than runtime.
Get the sqlc source
Clone the repository and explore it locally.
git clone https://github.com/sqlc-dev/sqlc.gitcd sqlc# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Define SQL queries in `.sql` files and configure sqlc via `sqlc.yaml`; integrate code generation into build pipeline (CI/Makefile) to keep generated code in sync with schema.
- Generated code is read-only and version-controlled; ensure team understands this is a build artifact and modifications must occur at the SQL layer.
- Database schema must be accessible or mocked during code generation; manage schema versions and migrations alongside sqlc config to avoid generation failures.
- Each supported language (Go, Python, Kotlin, TypeScript) has a separate plugin; verify plugin stability and feature parity before adopting for production in non-Go languages.
- Plugin system (WASM-based) allows custom language support; custom plugins require plugin development expertise and may not receive same support as core generators.
When to avoid it — and what to weigh
- Requirement for complex ORM features (relationships, eager loading, lazy loading) — sqlc is a code generator, not an ORM. It does not provide automatic relationship management, lazy loading, or query composition—teams needing Hibernate/SQLAlchemy-level abstraction should use a traditional ORM.
- Dynamic query construction is primary pattern — sqlc requires upfront SQL query definitions. Applications that heavily build queries at runtime or use dynamic filter builders will find sqlc's compile-time model restrictive.
- Team unfamiliar with SQL or preferring query builders — sqlc demands SQL fluency. Teams accustomed to query DSLs (Arel, LINQ) or those avoiding direct SQL may face friction; adoption requires SQL expertise.
- Schema churn or exploratory/prototype-stage projects — Frequent schema changes require regenerating code and updating call sites. Early-stage projects with unstable schemas may incur higher maintenance burden than dynamic query engines.
License & commercial use
Licensed under MIT (permissive, OSI-approved). Permits commercial use, modification, and distribution with minimal restrictions; requires license/copyright notice retention.
MIT license explicitly permits commercial use without additional restrictions or licensing fees. No proprietary clause; suitable for closed-source products. Verify no commercial support SLA is bundled if enterprise support is required; consult terms of use for any hosted services (playground, etc.).
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
sqlc generates parameterized queries, eliminating SQL injection risk at the query level. Generated code enforces type safety. No security audit data provided. Review plugin source code if using custom language backends (WASM plugins could theoretically be attack surface, though isolation model mitigates risk). Standard Go security practices apply to the tool itself.
Alternatives to consider
sqlc alternatives: sqlx, pgx (Go-only), Gorm, SQLAlchemy (Python)
Manual query wrappers or full ORMs; trade code generation convenience for runtime flexibility or schema abstraction. sqlx/pgx require more boilerplate; ORMs abstract SQL but reduce control.
ORM-like alternatives: Prisma, TypeORM
Schema-first, language-specific; offer relationship management and migrations out-of-box. Prisma and TypeORM provide higher abstraction; sqlc stays closer to SQL with less magic.
Other code generators: XO, protoc-gen-go-sql
Similar static generation approach but smaller communities and fewer language backends. sqlc has stronger adoption and broader database support.
Build on sqlc with DEV.co software developers
Evaluate sqlc's fit for your project. Review documentation, try the playground, and assess schema stability and team SQL expertise. Contact us to scope implementation for your codebase.
Talk to DEV.coRelated on DEV.co
Explore the category and the services that help you build with it.
sqlc FAQ
Does sqlc support dynamic queries or query builders?
Can I use sqlc with an existing migration tool (Flyway, Alembic)?
Does sqlc generate ORM-like features (lazy loading, relationship traversal)?
Is the Python/TypeScript/Kotlin support as mature as Go?
Software developers & web developers for hire
DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If sqlc is part of your open-source databases roadmap, our team can implement, customize, migrate, and maintain it.
Ready to add type-safe SQL to your stack?
Evaluate sqlc's fit for your project. Review documentation, try the playground, and assess schema stability and team SQL expertise. Contact us to scope implementation for your codebase.