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).

At least ideally. If it's not, that's something to be reported and fixed but there'd be no automatic workaround for now.




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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to