You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several existing behaviors related to backend table models timestamp columns were observed:
Tables' "update_date" (model.py) is empty during programmatically INSERT. We would like to have initial values as "create_date" during insert.
Previously we didn't notice the value inserted into timestamp column using datetime.datetime.now() (in model.py) is a fixed value. This means the timestamp value is determined during model is loaded, and all the records inserted with this datetime.datetime.now() (in model.py) after backend model is loaded will have the same values and not the moment the records are inserted. We will need to fix this.
Most of the timestamp columns are timestamp WITH TIME ZON, but some tables have timestamp WITHOUT TIME ZON. We need to make them consistent.
Screenshots
Acceptance Criteria
Discuss if needs to have or fix "update_date" in model.py to have value during initial insert.
Fix timestamp columns for all tables to use Sqlalchemy func.utcnow() than datetime.datetime.now().
Use timestamp WITH TIME ZON for all timestamp columns.
Make sure all existing tests still pass.
Document and close previous sqlacodegen tickets (on generating the model.py)
Additional context
May need to discuss why we need to have value for the "update_date" during initial insert (so it is not empty when record is created), or if this is a good practice; and how to deal with current production empty "update_date" if we decide to have value in "update_date" initial during insert.
Related issue #1695 created to split off some refactoring of model.py
The text was updated successfully, but these errors were encountered:
gormless87
changed the title
Fix backend model update_date without initial value during insert
Standardize datetime configuration on the backend
Dec 10, 2024
Several existing behaviors related to backend table models timestamp columns were observed:
datetime.datetime.now()
(in model.py) is a fixed value. This means the timestamp value is determined during model is loaded, and all the records inserted with thisdatetime.datetime.now()
(in model.py) after backend model is loaded will have the same values and not the moment the records are inserted. We will need to fix this.Screenshots
Acceptance Criteria
func.utcnow()
thandatetime.datetime.now()
.Additional context
Related issue #1695 created to split off some refactoring of model.py
The text was updated successfully, but these errors were encountered: