Skip to content

Support YAML anchors in sqlc.yaml #2653

Closed
@kevinvalk

Description

@kevinvalk

What do you want to change?

Currently I am working on a microservices project using SQLC. All is fine, but I find myself repeating the same configuration options for each codegen section. Using YAML anchors this would be trivial and very nice, but this is currently not supported.

Then I could do something like the following.

sql:
  - schema: database
    queries: services/a
    engine: postgresql
    codegen:
      - out: gateway/src/gateway/services/organization
        plugin: py
        options: &base-options
          query_parameter_limit: 1
          package: gateway
          output_models_file_name: null
          emit_module: true
          emit_generators: false
          emit_async: true

  - schema: database
    queries: services/b
    engine: postgresql
    codegen:
      - out: gateway/src/gateway/services/project
        plugin: py
        options: *base-options

https://play.sqlc.dev/p/32c6b52785ce13ddfeb2311a2a835800d2578b56bf1addd95887e3fe45d2ace0

What database engines need to be changed?

No response

What programming language backends need to be changed?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⚙️ processProcess-based pluginsbugSomething isn't workingpanic

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions