deduped_posts = db.session.query(Post, post_popularity).join(Place).filter(
    Post.id == popular_post_id).order_by(post_popularity.desc(), Post.
    timestamp.desc()).all()
How can I query rows with unique values on a joined column?