oodb philosophics ;) was: Re: [Zope-dev] Experiments with

Casey Duncan cduncan@kaivo.com
Fri, 11 May 2001 14:22:48 -0600


Cees de Groot wrote:
> 
> David Brown <ddb@namshub.org> said:
> >But isn't Python a decent query language?  Isn't it nice to be able to have
> >all of the facilities of Python at your disposal when manipulating data,
> >rather than hoping that whatever database you are using doesn't have a
> >brain-damaged implementation of SQL?
> >
> Yup. Our business objects are sitting on top of my homebrew O/R mapping layer,
> and I find myself entering the Python shell to do ad-hoc stuff with them more
> and more often. Especially because stuff that repeats one or two times is
> easily added as a method on the object for later reference...
> 
> One nice idea that should be possible in Pythonland as well: a Smalltalk O/R
> mapping layer called GLORP uses Smalltalk as a query language in a very nice
> way. Queries are given as Smalltalk blocks (say lambdas), and the mapping
> layer interprets the block's parse tree in order to spit out equivalent SQL
> code. Say:
> 
> Employees.get(lambda e: e.name[:3] == 'Foo')
> 
> to get all employees that have a name starting with "Foo".
> 

The only problem with this is that lambdas are not safe for TTW
scripting 8^(.

Although a safe lambda could probably be conceived of course...

-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>