Skip to content

sqlc generate fails if configured with a URI for sqlc vet, but if a DB is not running #3009

Answered by kyleconroy
alecthomas asked this question in Q&A
Discussion options

You must be logged in to vote

In 1.23 we added the database-based query analyzer. This is turned on if you have a database URI set.

There be a flag I could use to disable this, if it used for some reason I'm unaware of.

The analyzer.database configuration option is what you're looking for. Here's how to set it.

version: "2"
sql:
  - engine: "postgresql"
    queries: "backend/controller/sql/queries.sql"
    schema: "backend/controller/sql/schema"
    database:
      uri: postgres://localhost/ftl?sslmode=disable&user=postgres&password=secret
    analyzer:
      database: false
    gen:
      go:
        package: "sql"
        sql_package: "pgx/v5"
        out: "backend/controller/sql"

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@alecthomas
Comment options

Answer selected by kyleconroy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants
Converted from issue

This discussion was converted from issue #3008 on November 24, 2023 19:31.