I'm working with flask(sqlalchemy) and postgres, i already declared a model with a datetime column that defaults to datetime.utcnow() courtesy of the datetime module in python. however i noticed on new row insertions the time never changes, i did a few digging and found i shouldn't be calling the function but rather passing it thus: datetime.utcnow
So, i now wish to alter the column to reflect this change without having to drop the table/column.
I already tried ALTER TABLE mytable ALTER COLUMN trans_time SET DEFAULT datetime.utcnow and i get the following error: ERROR:  cannot use column reference in DEFAULT expression
Note: I don't have migrations set up for this project so that would not help for now. i only need to do this via sql commands.
I would

Rename the original table
Create a new table with the original table name with the default value as you now want it
Populate the new table with data from the original one
Drop the old table if everything looks OK.

Hope that works for you. Good luck!
How to alter a postgres datetime column to default to datetime.utcnow