| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
PS, looks like the same thing happens for Literal |
|
You need to specify column type using Field(sa_type=sa.String) |
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
{{title}}
Uh oh!
There was an error while loading. Please reload this page.
First Check
Commit to Help
Example Code
Description
I am trying to set up a database with SQLModel where some fields use typing.NewType. This does not change the runtime type at all, it is just a way to make certain subtypes distinct to a typechecker like Mypy.
If I run the example code, metadata.create_all() produces an error on line 571 of sqlmodel/main.py. The issue seems to be that issubclass() does not recognize a NewType as a class. Currently, I can get around the problem with:
but that seems like explicitly checking TYPE_CHECKING kind of defeats the purpose of typing.NewType.
Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.19
Python Version
3.12.3
Additional Context
No response