How can I compare just the dates of datetime in SQLAlchemy? How can I compare just the dates of datetime in SQLAlchemy? flask flask

How can I compare just the dates of datetime in SQLAlchemy?


Rather than querying "in" all days of the week use the days as limits.

today = date.today()start_of_week = today - timedelta(days=today.weekday())start_of_following_week = start_of_week + timedelta(days=7)weekly_schedule = WeeklyHour.query.filter(    and_(        WeeklyHour.start_time >= start_of_week,  # On or after Monday        WeeklyHour.end_time < start_of_following_week, # Before next Monday        WeeklyHour.employee == employee        )    ).all()