First Check
Commit to Help
Example Code
import sqlmodel as sqlm
class BarType(str):
@property
def with_prefix(self):
return f"PREFIX! {self}"
class Foo(SQLModel, table=True):
id: str = sqlm.Field(primary_key=True)
bar: BarType
# Works
foo = Foo(id="some-id", bar="test")
assert isinstance(foo.bar, BarType)
# Though this fails:
foo = load_foo_from_db()
assert isinstance(foo.bar, BarType) # FAILS!
Description
The types are currently lying when loading from db. :)
Wanted Solution
They should work.
Wanted Code
Some thing as above, but works.
Alternatives
No response
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.9
Additional Context
No response
First Check
Commit to Help
Example Code
Description
The types are currently lying when loading from db. :)
Wanted Solution
They should work.
Wanted Code
Alternatives
No response
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.9
Additional Context
No response