Uh oh!
There was an error while loading. Please reload this page.
Using sa_type causes Mypy type error #955
Unanswered
vinodkumars
asked this question in
Questions
Replies: 3 comments 1 reply
I also faced the same problem. Are there any solutions? I use |
0 replies
Same basic thing with pyright: |
0 replies
It seems that you should use fromtypingimportOptionalfromdatetimeimportdatetimefromsqlmodelimportColumn, DateTime, Field, SQLModel, funcclassDateTimeTest(SQLModel):
__tablename__="date_time_test"created_at: Optional[datetime] =Field(
sa_column=Column(DateTime(timezone=True), server_default=func.now())
) |
1 reply
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
First Check
Commit to Help
Example Code
Description
Creating a column with sa_type causes a type error with Mypy. Here is the error:
Operating System
macOS
Operating System Details
No response
SQLModel Version
0.0.18
Python Version
3.11.8
Additional Context
No response
All reactions