Reputation: 435
I have an SQLAlchemy DB column which is of type datetime:
type(<my_object>) --> sqlalchemy.orm.attributes.InstrumentedAttribute
How do I reach the actual date in order to filter the DB by weekday()
?
Upvotes: 5
Views: 5309
Reputation: 435
I got it:
from sqlalchemy import func
(func.extract(<my_object>, 'dow') == some_day)
dow stands for 'day of week' The extract is an SQLAlchemy function allowing the extraction of any field from the column object.
Upvotes: 7