This is a bad (inefficient) approach:
daily_max = db.session.query(db.func.count(Events.id), db.func.date_format(Events.timestamp_event,'%d/%m/%y'))\ .group_by(db.func.date_format(Events.timestamp_event,'%Y%M%D'))\ .order_by(db.func.count(Events.id).desc()).first()
It groups all (id count, date) pairs, sorts the pairs in reverse order of count, and gets the first pair.
It gets the job done, but I'd really like to know an efficient, elegant way to use func.max().