[Zope] debugging zsql methods from python scripts

Dieter Maurer dieter@handshake.de
Sun, 22 Jun 2003 23:59:15 +0200


jwsacksteder@ramprecision.com wrote at 2003-6-20 15:26 -0400:
 > I am attempting to call a ZSQL method from within a python script with
 > parameters and the result object I get back is not what I expected.
 > Specifically, if I print len(results) inside my python script, it tells me
 > that there are zero elements in my result. If I test the ZSQL method in the
 > ZMI and supply the two parameters it needs by hand, I see the results I
 > expect to see. Obviously my query is incorrect in some way. Is there a way
 > to observe the literal sql statement that is being passed into my DBMS? 
 > 
 > I have found it extremely useful to consult the 'SQL used' area on the test
 > tab of ZSQL method when troubleshooting composed SQL statements. Is there
 > anyway to get the same information programmatically inside a Python script? 

ZSQL Method's "__call__" has an "src__" parameter. When you
pass a true value, the method returs the generated SQL source
(without executing it).


Dieter