[orm-devel] Re: [orm-users] orm with mxODBC

Kevin Howe orm-devel@mailman.tux4web.de
Mon, 23 Jun 2003 11:20:46 -0400


> I'm not sure, how to do this, yet. Perhaps there are not going to be
> JOINs, but rather better support for VIEWs (which in turn may contain
> JOINs)...

I read about this on the mailing list, views are an interesting idea.
However if I could put my vote in, the feature I'd like to see implemented
would be this one:

http://mailman.tux4web.de/pipermail/orm-users/2003-May/000015.html

So that you could do queries like the following, which to me seem very
natural:

# fetch only canadian addresses
addresses = person.addresses(country='CA')

A very useful yet simple extension of this would be to allow the passing of
an "operator" object in order to specify a condition:

import ops

# employees older than 25
company.employees(age=ops.GT(25))

# employees of certain ages only
company.employees(age=ops.IN(25, 30)

Where "ops" would contain a class for each operator type. In the above
example we have the "greater than" and "in" operator classes. Each operator
class's __repr__ method would return the appropriate sql condition:

GT would produce: Age > 25
IN would produce: Age IN (25, 30)

Anything more complex than this would be left to runSelect().

- Kevin