I have a Datetime column and I am trying to filter that column by everything occurring on a Saturday.
I can filter Datetime by casting it to a date and comparing it to a date string like this:
session.query(SQL_table).filter(cast(SQL_table.datetime_column, Date) == '2020-7-1').all()
But how do I say I want that column to return everything that is on a certain day of the week? I tried this:
session.query(SQL_table).filter(cast(SQL_table.datetime_column, Date).strftime('%A') == 'Saturday').all()
This gives me the error:
AttributeError: Neither 'Cast' object nor 'Comparator' object has an attribute 'strftime'
So how do I cast the column to a weekday and filter it by a specific day then?