Skip to content

✨ Add IntEnum for sqltypes #1337

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

KunxiSun
Copy link

@KunxiSun KunxiSun commented Apr 3, 2025

I add a IntEnum type decorator which I used in my private project.

I wish it helps!

from enum import IntEnum
class HeroStatus(IntEnum):
    ACTIVE = 1
    DISABLE = 2    

from sqlmodel import IntEnum
class Hero(SQLModel):
    hero_status: HeroStatus = Field(sa_type=IntEnum(HeroStatus))


user.hero_status == Status.ACTIVE      # Loads back as enum

@KunxiSun
Copy link
Author

KunxiSun commented Apr 3, 2025

Any know how to fix the lint check? It seems to be caused by code not included in my PR.
image

@svlandeg svlandeg changed the title Add IntEnum for sqltypes ✨ Add IntEnum for sqltypes Apr 4, 2025
@svlandeg svlandeg added the feature New feature or request label Apr 4, 2025
@KunxiSun
Copy link
Author

KunxiSun commented Apr 8, 2025

@svlandeg
Hi! Any ideas about what's going on in the Github action tests? I saw they are failed in some other new PR.

@svlandeg
Copy link
Member

svlandeg commented Apr 9, 2025

@KunxiSun: Yes - those are unrelated to your PR. We're looking into it here.

@KunxiSun
Copy link
Author

@KunxiSun: Yes - those are unrelated to your PR. We're looking into it here.

Thanks to let me know

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

Successfully merging this pull request may close these issues.

2 participants