Silva altepeter.net Not logged in.

Family

Videos

Technology Stuff

Articles

Fun

Silva Products

Web Design

VIVO Javascript Framework

Photo Galleries

Contact Us

Blog

Testing Zope ZSQL Methods

When developing a zope application that uses zsql methods, I've always found it difficult to actually *see* what the parsed zsql method is -- i.e. the actual sql that is being sent to the server.


I don't believe this is actually documented anywhere, but I found in the source code to the base class for ZSQL methods, Shared/DC/ZRDB/DA.py, DA.__call__ has a few hooks for testing and getting the parsed sql from the ZSQL method.

To summarize, there are two parameters that can be included when you call __call__, src__ and test__

src__:  If this parameter is true, then the parsed ZSQL method is returned without actually querying the database.

test__: If this parameter is true (src__ must be false!), then the query is performed on the database and the parsed ZSQL method as well as the results are returned in a 2-tuple of the format (query, result)