Columns can't be a NewType
, raises TypeError: issubclass() arg 1 must be a class
#981
Unanswered
rdozier-work
asked this question in
Questions
Replies: 1 comment
-
PS, looks like the same thing happens for |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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 ofsqlmodel/main.py
. The issue seems to be thatissubclass()
does not recognize aNewType
as a class. Currently, I can get around the problem with:but that seems like explicitly checking
TYPE_CHECKING
kind of defeats the purpose oftyping.NewType
.Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.19
Python Version
3.12.3
Additional Context
No response
Beta Was this translation helpful? Give feedback.
All reactions