Sure, use a relationship() between Meetings and User and join on that: s.query(Meetings, User).join(Meetings.authors).all()
On Jun 21, 2013, at 11:05 AM, Mauricio de Abreu Antunes <mauricio.abr...@gmail.com> wrote: > My question looks simple but I need help to improve it. > I have two tables User and Meetings. > There is a relation on two keys (User.id == Meetings.author_id). > > The following code does the job: > db.session.query(Meetings, User).filter(Meetings.author_id == User.id).all() > > Is there any other way to improve it? > > Thanks. > > -- > Mauricio de Abreu Antunes > Mobile: (51)930-74-525 > Skype: mauricio.abreua > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.