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

Casey Duncan cduncan@kaivo.com
Fri, 11 May 2001 13:53:18 -0600


David Brown wrote:
> 
> At 11:45 AM 5/11/2001 -0600, Casey Duncan wrote:
> 
> >One of the biggest limitations in my mind is the lack of a general query
> >language for the ZODB like what you get with most OODBMS and all RDBMS.
> 
> I used to think this as well.
> 
> 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?

No and yes. Python is a great oop language, it has no inherent querying
capabilites though outside of namespace lookups (with acquisition when
in Zope) and dictionaries. You would need to build in all possible
queries as Python methods none of which would be very general. This is
something you need not do with a general query language where you can
make arbitrary queries at will.

> Isn't it nice not to have to convert back and forth between SQL types and
> native types?  Isn't it nice not to have to swap in your SQL mind in the
> middle of your Python program?

I am not arguing necessarily for SQL as a query language for the ZODB.
Although it is an accepted standard, but not a perfect one by any means
especially for OODBs. Its appeal lies mainly in the high level of
community familiarity and the plethora of SQL software to borrow from.
 
> Having a general query language makes it easy for people who know that
> particular general query language to write programs.  It makes it easy to
> access a bunch of different data sources, at least until the monster named
> "implementation differences" rears it's ugly head.
> 
> We've all spent years learning to make our programs interface with
> databases, learning how to jump the mental chasm between our programs and
> they way they want to manipulate data, and the way that the database wants
> to manipulate data.  Isn't it nice not to have to do that any more?

Yes, I would argue for a tight integration between the query mechanism
and regular Python, something that Catalogs have begun to implement.
However their query language is a very limiting argument list. Perhaps a
more general Python based query language of some kind needs to be
developed. Something like an expression that returns the set of objects
that meet its criteria. Exactly what this would be would need much
community (Python and Zope) discussion. A start to this discussion can
be found here:

http://dev.zope.org/Wikis/DevSite/Proposals/UnionAndIntersectionOperations

> 
> Don't get me wrong, I believe I get your point.  SQL implementations are
> getting more and more compatible.  There are OODBMS query languages
> specified.  There's no really good way of making different programming
> languages and programming environments interoperate without some sort of
> common meeting ground, like a general query language.

A be all query language for all databases (Which would be SQL at this
point, which is not necessarily tailored to OODBs) will always have
compromises and flaws. I look at something like CORBA which is can be
used to tie programs of all different languages together. Unfortunately
the result of reconsiling COBOL, C, Python, Java, Perl, BASIC, etc. to
some common ground is not always very pretty.

I would really be happy just to get Python (and possibly C) to be able
to perform general ZODB queries without resorting to kludges like
spam_usage='range:min:max'. So what I am talking about is not really
general, but mostly Python/ZODB specific.

> 
> And perhaps I'm overdoing the response, perhaps I've gone off in a
> different direction.  I've just been thinking about this quite a bit lately.
> 
> dave

I think this is a very important topic of discussion. Thanks for adding
your thoughts!

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