Michael Bayer wrote:

On May 11, 2006, at 12:54 PM, HD Mail wrote:

This seems to facilitate a much more flexible style of building select statements, rather then passing these things as parameters.
It would be nice to make the select() also using this style.
so building selects can be

s = select([users])
if order_by_address:
   s.order_by(addresstable.c.address)
else:
   s.order_by(user.c.id)
s.limit(5)
curs = s.execute()


when you use the SelectResults extension, the select() method also has the same behavior (except for the execute part).

Do we really want to use that slicing [] syntax though ? I tend to switch to SQL mode when writing queries in SA, so SQL keyword functions like order_by, limit(limit, offset=None), having(), for_update() etc. would make much more sense. Using specific python syntax for this single case just feels inconsistent.


well the extension is totally based on the similar functionality in SQLObject and i think the LIMIT/OFFSET part of it is something people look for as well. But you can mix and match both styles using select(), in fact. how un-pythonic (as usual).

I actually hate that word "pythonic". It's one of those words people use for so many different reasons without consistency. I like having many ways of doing things, because it provides convenience, matches different trains of thought, different uses cases etc.. As long as there is consistency, and people can intuitively guess on how something should work, I think this is ideal. So it's okay that select(order_by=None, limt=None).order_by().limit() exist, as long as it also exists on select_by and what ever other query statement that are applicable.

Just MO so feel free to ignore.


i never ignore anything !  (intentionally)
Always a good attitude.....I try but there is so much garbage on the web.

regards,

Huy


-------------------------------------------------------
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
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to