Skip to content

🐛Add check for Literal type annotation in get_sqlalchemy_type #1439

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 1 commit into
base: main
Choose a base branch
from

Conversation

nsaccente
Copy link

This PR addresses issue 57. The original issue explains that attempting to use a Literal type annotation in a SQLModel raises a type error from issubclass. This is because Literal is not a class, but a typing._SpecialForm, so static funcs like isinstance and issubclass don't work with it.

The fix was pretty straightforward, I just added a check before an isinstance or issubclass would have been called that checks if type_ is Literal.

@nsaccente nsaccente changed the title Add check for Literal type annotation in get_sqlalchemy_type 🐛Add check for Literal type annotation in get_sqlalchemy_type Jul 24, 2025
@nsaccente
Copy link
Author

I have no idea how to add the proper labels to this PR, it looks like the permissions aren't set up to allow me to.

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