@ChielWH: No, default values provided in SQLModel/SQLAlchemy columns through the default parameter are invoked client-side by SQLAlchemy before data is passed to the database, and are not part of the table's DDL definition. To create a server-side default value that is part of the table's definition, the server_default parameter must be used instead.
Activity
ChielWH commented on Feb 17, 2022
Shouldn't it result in:
?
skykasko commented on Feb 17, 2022
@ChielWH: No, default values provided in SQLModel/SQLAlchemy columns through the default parameter are invoked client-side by SQLAlchemy before data is passed to the database, and are not part of the table's DDL definition. To create a server-side default value that is part of the table's definition, the server_default parameter must be used instead.
See: https://docs.sqlalchemy.org/en/14/core/defaults.html.
ChielWH commented on Feb 17, 2022
@skykasko All clear, makes good sense though 👍
tiangolo commented on Aug 27, 2022
Thanks for the detailed report and fix @van51! 🙇 🍰