[Zope] debugging zsql methods from python scripts

jwsacksteder@ramprecision.com jwsacksteder@ramprecision.com
Fri, 20 Jun 2003 15:26:07 -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?