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

"false" instead of "False" in generated code #65

Open
Dracax opened this issue Dec 22, 2024 · 0 comments · May be fixed by #67
Open

"false" instead of "False" in generated code #65

Dracax opened this issue Dec 22, 2024 · 0 comments · May be fixed by #67

Comments

@Dracax
Copy link

Dracax commented Dec 22, 2024

Describe the bug
In the generated dataclass code a "normal" false appears instead of the python version.

To Reproduce
Steps to reproduce the behavior:

  1. Create a CREATE TABLE statement, containing this column: edited boolean DEFAULT false,
  2. Generate the dataclass: create_models(ddl, models_type="dataclass")
  3. The dataclass has this line: edited: Optional[bool] = false

Expected behavior
false -> False

Screenshots

CREATE TABLE Material
    (
        id integer,
        name      string,
        edited   boolean DEFAULT false,
        deleted  boolean DEFAULT true,
        PRIMARY KEY (id, name)
    );
@dataclass
class Material:

    id: int
    name: str
    edited: bool = false
    deleted: bool = true

If you like a can present a possible fix. In the from_ddl.py and prepare_data function I would change the bool.

@Dracax Dracax changed the title "false" insteat of "False" in generated code "false" instead of "False" in generated code Dec 22, 2024
Dracax added a commit to Dracax/omymodels that referenced this issue Jan 17, 2025
Dracax added a commit to Dracax/omymodels that referenced this issue Jan 17, 2025
@Dracax Dracax linked a pull request Jan 17, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant