On Thu, Sep 24, 2015 at 11:16:37AM -0400, Mike Bayer wrote: > > > On 9/24/15 9:32 AM, Julien Cigar wrote: > > Hello, > > > > I'm using SQLAlchemy 1.0.8 with joinedload inheritance. On one of the > > Child I have a relationship property and I wondered if there is an easy > > way to innerjoin=True this relation only in a non-polymorphic context ? > > > > In my case I have the base class "Content", a child "Event", and "Event" > > has a relationship to "Country". > > > > So I when I do Session.query(Event) it should INNER JOIN Country, but > > with orm.with_polymorphic(Content, [Event]) the Country relationship > > should be LEFT OUTER JOIN, otherwhise the query returns no result ... > > > > I wondered if there was already something in SQLAlchemy do handle this > > case (other than joinedload(), etc ..) ? > > the relationship() is bound to Event only. If you set innerjoin=True on > that relationship(), that handles query(Event), but when you do > with_polymorphic(Content, [Event]), the joins *should* be nesting on the > right side in modern versions, e.g. SELECT content.*, event.* FROM > content LEFT OUTER JOIN (event INNER JOIN country).
I haven't tested with git HEAD but in 1.0.8 the joins aren't nested (unless I did something wrong) > > At least ideally. If it's not, that's something to be reported and > fixed but there'd be no automatic workaround for now. > I'll make a bug report + test case as soon as I have little time .. As always, thanks for your quick reply! > > > > > > Thanks! > > Julien > > > > -- > 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/d/optout. -- Julien Cigar Belgian Biodiversity Platform (http://www.biodiversity.be) PGP fingerprint: EEF9 F697 4B68 D275 7B11 6A25 B2BB 3710 A204 23C0 No trees were killed in the creation of this message. However, many electrons were terribly inconvenienced. -- 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/d/optout.
pgpjnFthq74bz.pgp
Description: PGP signature