On May 8, 2006, at 12:27 PM, Sandro Dentella wrote:
On Mon, May 08, 2006 at 11:30:54AM -0400, Michael Bayer wrote:
you mean you want this:
m = mapper(SomeClass, mytable)
result = m.select_by(someothertable.c.something>45)
which will automatically create a JOIN from 'mytable' to
'someothertable'.
no I was rather thinking at what is provided by select_by: ie: an
implicit
join on the tables.
If I use select_by, I cannot use limit= and parameters= so I tried
to use
select but I see all the time I need to specify the join condition
that I
already put into the mapper (via properties = relation(...)).
So I wander:
1. why the implicit behaviour of select_by (ie: join) isn't the
default
of a mapper that was already prepared to be a join? As I told
in a
prevuous message and if I undertsand it correctly this leads
to a CROSS
JOIN that is probably not what anybody looks for...
because explicit is better than implicit. if you had multiple
relations against the same table, inheritance relationships against
the same table to which you have attribure relations, etc., its not
clear at all how it should implicitly "decide" what joins to create.
if the implicit behavior is forced, then theres no way to work around
it. if the implicit behavior is granted/ungranted by switches and
flags, then the interface becomes arbitrary and confusing. by
leaving it explicit, users have no confusion, no bug reports get sent
my way.
2. alternatively: why can't I use limit= and parameters= for
select_by?
because every keyword argument passed to select_by is part of the
criterion being used. select_by is only meant to be a shortcut in a
narrow range of situations (although its a very common situation).
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users