On Feb 18, 2010, at 11:55 AM, Manlio Perillo wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Michael Bayer ha scritto:
>> [...]
>>> so what I had in mind is that, if its given a join as the left side, 
>>> it just does the "natural" thing, i.e. joins to the right.
>>> If the "natural" join isn't available, then it does its usual
>>> search through the whole thing.
> 
> What do you mean by "natural join isn't available"?
> There is no direct foreign key relationship between the left and the
> right side of the join?

yes.

> 
>> 
>>> I think _match_primaries could, right before it raises its message,
> 
> Since we are speaking about _match_primaries, I'm curious to know why
> the implementation is:
> 
> def _match_primaries(self, primary, secondary):
>    global sql_util
>    if not sql_util:
>        from sqlalchemy.sql import util as sql_util
>    return sql_util.join_condition(primary, secondary)
> 
> What is the need for a sql_util to be global?

that pattern is used when there is a circular module import between two 
modules.    the global + boolean is to avoid repeated calls to "import".

> 
>>> just ask "well is this particular foreign key the rightmost join on
>>> the left side" and then its good.
>> 
> 
> Non sure to understand what you have in mind, here.
> 
> Do you mean that the checks:
> `if len(crit) == 0` and `len(constraints) > 1` should not be done by the
> util.join_condition, and instead:
> 
> 1) `_match_primaries` method will call `util.join_condition`, using the
>   rightmost join on the left side (as in my patch)
> 2) if len(crit) == 0, then it will call `util.join_condition` again, but
>   this time using the left side of the join, as is

that is pretty much what I mean.   if the left side is a join, then call 
join_condition with the rightmost side of the left first, if nothing returned, 
call with the full left side.



> 
> ?
> 
> 
>>> to get non-default behavior, as always you'd specify the on clause.
>>> which you'd have to do anyway even without the natural feature if you
>>> wanted to join....unnaturally.
>> 
> 
> Manlio
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkt9cOYACgkQscQJ24LbaUSS7QCeMchE6p2t3WaHDJzH+dTAu2Xk
> BBUAmQHpDq8Naq9f4cWsolK9BRnjTBcf
> =UAU4
> -----END PGP SIGNATURE-----
> 
> -- 
> 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.

Reply via email to