from db_conn import connect from sqlalchemy import func sys.path.append('/home/thebears/Nextcloud/Designs/NuggetTracker/CommonCode/') sq = connect() curr_time = datetime.now() last_date = datetime(curr_time.year, curr_time.month, curr_time.day, 18, 0, 0) last_beat = {i:last_date for i in range(4)} threshold_for_next_mealie = 25 min_time = 10; res = sq['s'].query(func.count(sq['t']['horizontalwheel'].c.transittime)).filter(sq['t']['horizontalwheel'].c.timestamp > last_date).all()