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

files generated for SQLite are missing type annotations. #64

Open
rfletchr opened this issue Nov 27, 2024 · 0 comments
Open

files generated for SQLite are missing type annotations. #64

rfletchr opened this issue Nov 27, 2024 · 0 comments

Comments

@rfletchr
Copy link

rfletchr commented Nov 27, 2024

When generating python code with the engine set to sqlite the generated code has every property annotated with the Any type.

If I switch the engine to postgresql everything works as expected.

version: '2'
plugins:
  - name: py
    wasm:
      url: https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.2.0.wasm
      sha256: a6c5d174c407007c3717eea36ff0882744346e6ba991f92f71d6ab2895204c0e
sql:
  - schema: "schema.sql"
    queries: "query.sql"
    engine: sqlite
    codegen:
      - out: src/modeldb/db/schema
        plugin: py
        options:
          package: modeldb.db.schema
          emit_sync_querier: true
          emit_async_querier: true
          query_parameter_limit: 5
CREATE TABLE file
(
    id          INTEGER NOT NULL,
    name        text NOT NULL,
    path        text NOT NULL,
    hash        text NOT NULL,
    resource_id INTEGER NOT NULL,
    PRIMARY KEY (id),
    FOREIGN KEY (resource_id) REFERENCES resource (id)
);
# Code generated by sqlc. DO NOT EDIT.
# versions:
#   sqlc v1.27.0
import dataclasses
from typing import Any, Optional


@dataclasses.dataclass()
class File:
    id: Any
    name: Any
    path: Any
    hash: Any
    resource_id: Any

I realise sqlite plays fast and loose with types, but so does python. It'd be very beneficial to have this working.

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

No branches or pull requests

1 participant