In my Flask model I have this column:
datetime = db.Column(db.DateTime, nullable=False, default=datetime.now)
When I populate the rows from a PostgreSql database I get this:
2020-07-03 18:12:49.362271
2020-07-04 09:21:34.644202
Now, I want to format those results using the to_char function from Postgresql. The query shoudl be this:
select to_char(datetime, 'YYYY-MM-DD HH24:MI:SS') as datetime from order_detail;
And the result is this:
---------------------
2020-07-03 18:12:49
2020-07-04 09:21:34
(2 rows)
How can I tell Flask-SqlAlchemy to execute that function when it queries the order_detail table?.
Important: I don't want to do the formatting in my Flask app, I want to let Postgresql format the results.