Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Managed databases with any accessible server #3415

Closed
kyleconroy opened this issue Jun 5, 2024 · 0 comments · Fixed by #3421
Closed

Managed databases with any accessible server #3415

kyleconroy opened this issue Jun 5, 2024 · 0 comments · Fixed by #3421
Labels
enhancement New feature or request
Milestone

Comments

@kyleconroy
Copy link
Collaborator

Managed databases only work using database servers hosted by sqlc Cloud. I'm going to add support for using managed databases with any database server you can access.

Database servers will be configured in a separate servers collection in the configuration file.

version: "2"
servers:
  - uri: postgres://localhost:5432/postgres

Each entry will have a mandatory uri field and an optional name. I may add an optional engine field if the URI scheme isn't enough to infer the engine type.

version: "2"
servers:
  - uri: postgres://localhost:5432/postgres
sql:
  - engine: "postgresql"
    queries: "query.sql"
    schema: "schema.sql"
    database:
      managed: true
    gen:
      go:
        package: "tutorial"
        out: "tutorial"
        sql_package: "pgx/v5"

When using a database server not hosted by sqlc Cloud, sqlc will automatically create databases as needed based on the schema for the associated query set. All operations against these databases will be read-only, so they can be created once and re-used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🛳 Shipped
1 participant