[Zope-DB] Relational Databases in Zope 2 and Zope 3

Charlie Clark charlie at egenix.com
Tue Jun 29 05:33:46 EDT 2004

On 2004-06-29 at 11:13:31 [+0200], Chris Withers <chris at simplistix.co.uk> 
> Charlie Clark wrote:
> > improvements over query strings on non-cached transactions. This proof of
> > concept requires changes to Zope core
> What changes were required?
> > 1) ZSQL - use property sheets and positional parameters.
> I don't understand this. Can you elaborate?

Yes. Currently Zope accepts parameters in an argument list which gets kind of 
lost in longer methods and also doesn't give you the positional security you 
need for positional parameters.

FROM relation
size = ?
age = ?


See the Python or mxODBCZopeDA docs for information.

I've been *very* happy with ZSQLs so far but things could be improved.
A property sheet would ideally be a pop-up window which can be held next to 
the SQL source for reference. This might include extensions to have 
pull-downs for the DB data types although this is probably unnecessary in 
Zope as the type checking will be done by the DB driver but might be useful 
info for the developer. Anything variable specified in the property sheet 
would have to be supplied.
> > Personally I'd like
> > to drop DTML support in ZSQL altogether.
> I think you need SOME language to template SQL...

Agreed but DTML isn't it.
> > Jim Fulton made the suggestion that
> > <dtml-sqlvar> parsing could be modified to return '?' and a tuple element 
> > to
> > preserve backwards compatability but we think this would no longer be
> > necessary. It might, however, be worthwhile to have something like ZPT for
> > ZSQL to encourage reuse and embedding in applications.
> ...but I'd like this to be ZPT, sadly other people poo-poo the idea every 
> time I
> mention it :-s

Well, it or a subset of it would get my vote. It is more appropriate and 
would have the added benefit of reinforcing the good practices which I think 
ZPT encourages. Can you submit submit some examples of how you'd see things 
working with ZPT?
> > 2) DA / Zope integration. It is probably possible to interact directly 
> > with
> > Transactional and drop most of the current ZRDB source passing the
> > responsiblity of quoting to the driver. This would reduce the Zope 
> > codebase
> > to be maintained, simplify DA development and improve performance.
> Sounds good to me...
> > 3) Improve usability. It seems quite clear that despite the advantages of
> > ZODB there are many people who need to access existing RDBMs and while 
> > this
> > is very easy in Zope it is important to encourage and support best
> > "relational" practice with the right tools and documentation.
> What do you mean by this? Do you have some examples?

mm, yes and no. When I've finished reading it Jim Penny's article will be 
available and I plan to write one of my own for getting those started who 
want to use Zope and relational systems. While I understand the excitement 
about O/R mapping I think it is easy to gloss over the fact that relational 
technology is good in its own right but you have to understand how to use it 
- ie., grasping the relational model and sticking with it. For really good 
articles on the use and abuse of relational technologies I'll defer to Fabian 
Pascal's and Chris Date's excellent website http://www.dbdebunk.com/

Anything on the particular side effects of <dtml> syntax in SQL is likely to 
provoke a flame war. Personally I find the <dtml> constructions extremely 
obscure and destracting but others seem to love them. It is likely then that 
any future ZSQL will have to include support.


More information about the Zope-DB mailing list