Select Date From Timestamp In Sqlalchemy
I'm using SQLAlchemy with python and i want to select date from column type timestamp, to do this query: SELECT DATE(`record_date`) FROM Users I made this code by sql alchemy but
give an alias
SELECTDATE(`record_date`) as record_d FROM Users
then use this
session.query(Users.record_d).all()
If want do it directly then ,try this
your_dates = session.query(cast(Users.record_date, DATE)).all()
EDIT:
your_dates = session.query(func.DATE(Users.record_date)).all()
You may like these posts
Post a Comment for "Select Date From Timestamp In Sqlalchemy"