Skip to content

files generated for SQLite are missing type annotations. #64

Open
@rfletchr

Description

@rfletchr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions