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

Niki Spahiev niki at vintech.bg
Tue Oct 14 12:28:43 EDT 2003


Phillip J. Eby wrote:

> At 02:20 PM 10/14/03 +0300, Niki Spahiev wrote:
> 
>> IIRC SQLObjects has many similar ideas implemented.
> 
> 
> Thanks, but as far as I can tell from its documentation, it does not 
> support correlation, aggregation, or grouping.  It only implements what 
> I consider "the easy part": pure filtering based on traversal 
> expressions from a single start set.  Such "easy" queries can be 
> executed now on Python objects, using the functions in 
> peak.model.queries, although SQL generation is not yet supported.
> 
> Generating SQL from "easy" queries involves a lot of details, but is 
> straightforward, on the whole.  Mostly it's a process of walking the 
> query to extract table aliases, joins, and criteria.
> 
> Here are PEAK's "hard" query requirements:
> 
> * Support correlations (e.g. the "find employees that lives in the same 
> city as their supervisor, but was born in a different country" example)

I am not native english speaker, but this looks like correlation to me:

 >>> peeps2 = Person.select(AND(PhoneNumber.q.personID == Person.q.id, 
PhoneNumber.q.phoneNumber.startswith('612')))

taken from SQLObject-0.3/examples/people.py

SQLObjects has also OR() and NOT()

Niki Spahiev





More information about the PEAK mailing list