Thanks for the 'join' tip!
From: [email protected] [mailto:[email protected]] On Behalf Of Wichert Akkerman Sent: Tuesday, January 22, 2013 11:47 AM To: [email protected] Subject: Re: [sqlalchemy] Couple of questions about filtering... On Jan 22, 2013, at 08:26 , Alexey Vihorev <[email protected]> wrote: Hi. Couple of questions... 1. Does SQLA support "deep filtering", i.e. something like this: query(Invoice).filter(Invoice.Customer.Country.name=='France') You'll need to use a join to do this: query(Invoice).join(Customer).join(Country).filter(Country.name == 'France') 2.Can I use hybrid properties for filtering? I tried to do that, but that's what I got: [..] p = Person('John', 'Doe') s.commit() res = s.query(Person).filter(Person.full_name=='John Doe').all() output: Person.first_name Person.last_name [] Note that you never added p to the session, so it was never stored. Try this: p = Person('John', 'Doe') s.add(p) print s.query(Person).all() Regards, Wichert. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
