Skip to content

Managed databases with any accessible server #3415

Closed
@kyleconroy

Description

@kyleconroy

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    🛳 Shipped

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions