# sqlc

> sqlc generates fully type-safe, idiomatic code from SQL queries, eliminating boilerplate database access code and catching schema errors before they reach production.

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 `.sql` files.
- Configure sqlc via a `sqlc.yaml` file specifying the target language, database engine, and output paths.
- Run `sqlc generate` to 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.

## 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

## Integrations
PostgreSQL, MySQL, SQLite, Go, Kotlin, Python, TypeScript

## Platforms
WINDOWS, MACOS, LINUX, API, CLI

## Pricing
Open Source

## Version
v1.31.1

## Links
- Website: https://sqlc.dev
- Documentation: https://docs.sqlc.dev
- Repository: https://github.com/sqlc-dev/sqlc
- EveryDev.ai: https://www.everydev.ai/tools/sqlc
