Skip to content

Local PostgreSQL container for query analysis / validation#4514

Closed
nikolayk812 wants to merge 4 commits into
sqlc-dev:mainfrom
nikolayk812:4513-pg-tc
Closed

Local PostgreSQL container for query analysis / validation#4514
nikolayk812 wants to merge 4 commits into
sqlc-dev:mainfrom
nikolayk812:4513-pg-tc

Conversation

@nikolayk812

@nikolayk812 nikolayk812 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Add a testcontainers_image field to the database config block. When set, sqlc automatically starts a local PostgreSQL Docker container, applies schema migrations, and uses it for analysis — then tears it down when done.

database:
      testcontainers_image: "postgres:18-alpine"

#4513

@davideimola

Copy link
Copy Markdown
Contributor

I really like the idea of using containers in development!

Comment thread internal/config/config.go
Managed bool `json:"managed" yaml:"managed"`
URI string `json:"uri" yaml:"uri"`
Managed bool `json:"managed" yaml:"managed"`
TestcontainersImage string `json:"testcontainers_image" yaml:"testcontainers_image"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it have to be called testcontainers_image? Why not just image or container_image to not leak implementation details about the library used to the public API?

@kyleconroy kyleconroy closed this Jul 15, 2026
@kyleconroy

Copy link
Copy Markdown
Collaborator

@nikolayk812 sorry, I'm not interested in adding Docker / container support at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants