sqlc (sqlc-dev/sqlc)
Searching Database…
What is this?
sqlc is a SQL compiler: you write your queries in plain SQL, and it generates type-safe code with interfaces to those queries that your application calls.
How is that different from using an ORM?
You keep writing real SQL — sqlc compiles those queries into type-safe code your app calls, instead of you maintaining table-to-object mappings by hand.
How do I get started with it?
Install the sqlc binary, write your queries as SQL files, run sqlc to generate the code, then call the generated functions from your application.
Which languages can it generate code for?
Go, Kotlin, Python, and TypeScript through the official sqlc-gen plugins, and further languages can be added via the plugin system.
Will it run on Windows, macOS, and Linux?
Yes — sqlc is a single Go tool distributed through its Downloads page, and Go builds natively for Windows, macOS, and Linux.
Why compile SQL into code instead of using an ORM?
The README points to an introductory blog post for the motivation; the idea is that your SQL stays the single source of truth while the code calling it is generated and type-safe.
Is sqlc free to use?
Yes — it is MIT-licensed open source, and development is supported by GitHub Sponsors.
Does sqlc touch my database at runtime?
No — it is a build-time tool: you run it to generate code, and at runtime your application just calls the generated functions like any other code in your project.
Which topics is it in?
orm, code-generation, compiler, kotlin, mysql, sql, sqlite, postgresql, database, go, tool, typescript


