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

Verify: ERROR unknown query set: queryset_0 Error verifying queries: errored #3567

Open
veqryn opened this issue Sep 1, 2024 · 1 comment

Comments

@veqryn
Copy link

veqryn commented Sep 1, 2024

Version

1.27.0

What happened?

I am trying to go through the tutorial, except with my own basic queries.
I get to the part where I am to try out the verify command, and get this error:

$ sqlc verify --against learning
FAIL    queryset_0
  ERROR unknown query set: queryset_0
Error verifying queries: errored

Please note that the generated model and queries work just fine.

Relevant log output

No response

Database schema

CREATE TYPE COLORS AS ENUM('red', 'green', 'blue');

CREATE TABLE accounts (
    id          BIGSERIAL PRIMARY KEY,
    name        VARCHAR(50)              NOT NULL,
    email       VARCHAR(50) UNIQUE       NOT NULL,
    active      BOOLEAN                  NOT NULL,
    fav_color   COLORS,
    fav_numbers INTEGER[],
    properties  JSONB,
    created_at  TIMESTAMP WITH TIME ZONE NOT NULL
);

INSERT INTO accounts (id, name, email, active, fav_color, fav_numbers, properties, created_at)
VALUES (1, 'Bob', 'bob@internal.com', true, 'red', '{5}', '{"tags": ["fun"]}', '2024-08-28T01:02:03Z'),
       (2, 'Jane', 'jane@internal.com', true, 'green', '{3, 19}', '{"tags": ["happy"]}', '2024-08-28T01:04:05Z'),
       (3, 'John', 'john@internal.com', false, null, '{}', '{}', '2024-08-28T01:06:07Z'),
       (4, 'Jack', 'jack@internal.com', false, null, null, null, NOW())
;

SQL queries

-- name: SelectAccountByID :one
SELECT *
FROM accounts
WHERE id = $1;

-- name: SelectAllAccounts :many
SELECT *
FROM accounts
ORDER BY id;

Configuration

version: "2"
cloud:
  project: 'myprojectid'
sql:
  - engine: "postgresql"
    queries: "query.sql"
    schema: "../data/01_schema.sql"
    gen:
      go:
        package: "model"
        out: "internal/model"
        sql_package: "pgx/v5"

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

@veqryn veqryn added the bug Something isn't working label Sep 1, 2024
@santheipman
Copy link

santheipman commented Sep 30, 2024

I have similar issue. I fixed it by add name to the config. In your case, the config should look like this:

version: "2"
cloud:
  project: 'myprojectid'
sql:
  - name: "queryName"
    engine: "postgresql"
    queries: "query.sql"
    schema: "../data/01_schema.sql"
    gen:
      go:
        package: "model"
        out: "internal/model"
        sql_package: "pgx/v5"

The error message ERROR unknown query set: queryset_0 should be improved

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

No branches or pull requests

2 participants