Kent wrote: > That's fair. > > I guess I wasn't thinking it would be automatic so much as it doesn't > need to default to False if there is a foreign key constraint on a non- > null column. In that particular case, whether automatic or manual, we > could safely 'default' to inner-join=True, I believe. > > But I'm not complaining, as I'm very grateful to have found the option > at all. It was just a suggestion.
its not "safe" in the case that someone made a primary join like "and_(foo.remote_id==remote.id, foo.statusflag==False)", for example. That still qualifies as a many-to-one but can be null on a join. then they have to turn "innerjoin" off. the "on/off" nature of innerjoin's defaults might confuse some new users. we do have this kind of "default" behavior for "uselist", though, i.e. is False for many-to-one and True for one-to-many. > > > > > On Feb 1, 12:22 pm, "Michael Bayer" <mike...@zzzcomputing.com> wrote: >> Kent wrote: >> > For performance reasons, I'd like eagerloading to do inner joins where >> > possible. I found ticket >> 1544http://www.sqlalchemy.org/trac/ticket/1544 >> > addresses exactly this concern, and I've patched the option for >> > innerjoin=True. >> >> > This works, thank you. >> >> > I wanted to point out, however, that the orm relation *should* be able >> > to detect scenarios where it is safe to do inner join by default >> > instead of this being a manually set flag. >> >> > If the join relation foreign key exists on a column that is >> > nullable=False, then (double check my logic, but..) isn't it >> > guaranteed that an inner join is safe? >> >> > If agreed, this would be a nice enhancement. >> >> the potential complication with "automatic" is a join condition that is >> more complex than just a simple many-to-one join on a single attribute. >> >> You also might want innerjoin on some one-to-ones and one-to-manys as >> well, those can't be automatic. So by leaving it manual, at least the >> configuration is consistent. >> >> im not opposed to it but by leaving it manual, I don't have to worry >> about >> surprise issues I haven't considered. >> >> >> >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "sqlalchemy" group. >> > To post to this group, send email to sqlalch...@googlegroups.com. >> > To unsubscribe from this group, send email to >> > sqlalchemy+unsubscr...@googlegroups.com. >> > 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 sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > 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 sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.