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

fix: enum generation if it does contain only equality-sign #59

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dswistowski
Copy link

@dswistowski dswistowski commented Nov 6, 2024

in case of type like:

CREATE TYPE operator AS ENUM (
    '=',
    '>',
    '<',
    '>=',
    '<='
);

current plugin will generate wrong python code:

class Operator(str, enum.Enum):
    = "="
    = ">"
    = "<"
    = ">="
    = "<="

after this change plugin will generate valid enum:

class Operator(str, enum.Enum):
    EQ = "="
    GT = ">"
    LT = "<"
    GTEQ = ">="
    LTEQ = "<="

in case of tye 'CREATE TYPE operator AS ENUM (\'=\', \'>\' ...)' current name generation will generate python enum with empty enum values names
@dswistowski dswistowski changed the title fix enum generation if it does contain only equality-sign fix: enum generation if it does contain only equality-sign Nov 6, 2024
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 this pull request may close these issues.

1 participant