-
-
Notifications
You must be signed in to change notification settings - Fork 782
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
First Check
- I added a very descriptive title to this issue.
- I used the GitHub search to find a similar issue and didn't find it.
- I searched the SQLModel documentation, with the integrated search.
- I already searched in Google "How to X in SQLModel" and didn't find any information.
- I already read and followed all the tutorial in the docs and didn't find an answer.
- I already checked if it is not related to SQLModel but to Pydantic.
- I already checked if it is not related to SQLModel but to SQLAlchemy.
Commit to Help
- I commit to help with one of those options 👆
Example Code
created_at: datetime.datetime = datetime.datetime.now()Description
I am trying to figure out a way to set the SQL column property "Default Value or Binding" via an SQLModel model. I'm trying to make it so that a datetime field defaults to GETUTCDATE(). I know I can do something like "created_at: datetime.datetime = datetime.datetime.now()" but that doesn't exactly apply the default to the column itself. I want to create the table with this default on the field so no matter how the data gets into that table, the field will always will in with GETUTCDATE(). Is there a way to do this in SQLModel? Thanks.
Operating System
Windows
Operating System Details
No response
SQLModel Version
0.0.6
Python Version
3.9.12
Additional Context
No response
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested
