Re: [sqlalchemy] finding if a table is already join in a query

2010-12-05 Thread Thadeus Burgess
What if your query already has a join yet you need to add another WHERE clause to the join? This fails with This query already has a join for Table xxx. Any way to modify your join to a query after you join it? -- Thadeus On Wed, Dec 1, 2010 at 8:08 AM, Michael Bayer

Re: [sqlalchemy] finding if a table is already join in a query

2010-12-05 Thread Michael Bayer
To the ON clause ? you'd need to find the join() and surgically replace its on clause, which again likely has issues in more complex cases, such as if any kind of aliasing is going on, joined table inheritance in use, etc. I'll reiterate that this is not the way I'd be approaching this

Re: [sqlalchemy] finding if a table is already join in a query

2010-12-01 Thread Michael Bayer
On Dec 1, 2010, at 1:28 AM, James Neethling wrote: if you would like multiple references to Address to all work from the same join, your routine needs to track which entities have already been joined as a destination in a separate collection: def search(columns): already_joined

[sqlalchemy] finding if a table is already join in a query

2010-11-30 Thread James Neethling
Hi all, We have a small function that helps us create a simple search query by automatically joining on required relations if needed. For example, consider an employee ORM that has a 1:M relationship with addresses (for postal/physical). We can do something like: query =

Re: [sqlalchemy] finding if a table is already join in a query

2010-11-30 Thread Michael Bayer
On Nov 30, 2010, at 11:13 AM, James Neethling wrote: Hi all, We have a small function that helps us create a simple search query by automatically joining on required relations if needed. For example, consider an employee ORM that has a 1:M relationship with addresses (for

Re: [sqlalchemy] finding if a table is already join in a query

2010-11-30 Thread James Neethling
On Tue, 2010-11-30 at 11:52 -0500, Michael Bayer wrote: On Nov 30, 2010, at 11:13 AM, James Neethling wrote: Hi all, We have a small function that helps us create a simple search query by automatically joining on required relations if needed. For example, consider an employee ORM