usually thats what people want for this particular question, since they
want all the behavior to be abstracted through their relation()s. but
since you have some actual SQL youd like, here goes:
straight select
s = select([forum_topic], forum_topic.c.id==forum_post.c.topic_id,
group_by=[forum_topic.c.id], order_by=[desc(forum_post.c.created)])
through the ORM:
session.query(ForumTopic).select(forum_topic.c.id==forum_post.c.topic_id,
group_by=[forum_topic.c.id], order_by=[desc(forum_post.c.created)])
if the GROUP BY doesnt work with the Query since i havent tested that
it gets propigated through to the generated query lately, you can feed
the full select into the query too:
result = session.query(ForumTopic).select(s)
or feed in its results:
result = session.query(ForumTopic).instances(s.execute())