[TransWarp] Towards a query theory, part 1: filters and correlation

Ian Bicking ianb at colorstudy.com
Wed Oct 15 01:22:22 EDT 2003


On Tuesday, October 14, 2003, at 11:54 PM, alexander smishlajev wrote:
> Ian Bicking wrote, at 14.10.2003 19:43:
>
>>> * Support aggregation (count/min/max/avg) over groups (GROUP BY in 
>>> SQL)
>> I would not put this in the query.  It doesn't effect which objects 
>> we find, but rather what results we return.
>
> ... and that can change the network traffic from the sql server in 
> several orders of magnitude.
>
> besides, aggregation performed by sql server in many cases is much 
> more efficient than whatever could be written in python.
>
> maybe i just didn't unerstand what did you mean by "not put this in 
> query"?

Maybe I should have said the "where clause" instead of "query" 
(selector? lazy conditional?).  In SQLObject you can manipulate the 
result set in various ways, like:

chicagoans = Employee.select(Employee.q.city == 'Chicago', 
orderBy=Employee.q.lastName)[:20]

The query, clause, whatever it's called, is "Employee.q.city == 
'Chicago'".  But it doesn't actually pull the results until after you 
iterate over the object, and you can change the order and some other 
things until then (in this instance it will add a LIMIT 20 or 
equivalent to the select statement).

--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org




More information about the PEAK mailing list