Using ZSQL Results in python: "dictionaries" property doesn't exist
Hi all! I am trying to use the "Results" variable returned by any ZSQL method in a python script, as shown in this how-to: http://www.zope.org/Members/spinwing/ZSQL_Results . The thing is I can access Results.names() and Results.data_dictionary() as shown in the examples there, but not Results.dictionaries(). It says that the property doesn't exist. Any ideas? Igor Leturia
IIRC there are depending on Database Adapter different types of Results; some have a dictionaries() and some dont (sorry cant remember the details, you can figure out the supported methods/attributes with the aid of an External Method) hasattr(r, 'colname') and/or getattr(r, 'colname', default) should work everywhere I think hth peter. On Tue, 19 Feb 2002, Igor Leturia wrote:
Hi all!
I am trying to use the "Results" variable returned by any ZSQL method in a python script, as shown in this how-to: http://www.zope.org/Members/spinwing/ZSQL_Results . The thing is I can access Results.names() and Results.data_dictionary() as shown in the examples there, but not Results.dictionaries(). It says that the property doesn't exist.
Any ideas?
Igor Leturia
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Peter Sabaini writes:
IIRC there are depending on Database Adapter different types of Results; some have a dictionaries() and some dont (sorry cant remember the details, you can figure out the supported methods/attributes with the aid of an External Method) This calls for "DocFinder":
Really neat, and with a little mod in showDocumentation it even documented a Shared.DC.ZRDB.RDB.DatabaseResults instance! (DatabaseResults dont have a title_and_id()) But I am still hoping to learn to use the Python Debugger one day :-) bye, peter Dieter Maurer wrote:
Peter Sabaini writes:
IIRC there are depending on Database Adapter different types of Results; some have a dictionaries() and some dont (sorry cant remember the details, you can figure out the supported methods/attributes with the aid of an External Method) This calls for "DocFinder":
<http://www.dieter.handshake.de/pyprojects/zope>
Dieter
Igor Leturia writes:
I am trying to use the "Results" variable returned by any ZSQL method in a python script, as shown in this how-to: http://www.zope.org/Members/spinwing/ZSQL_Results . The thing is I can access Results.names() and Results.data_dictionary() as shown in the examples there, but not Results.dictionaries(). It says that the property doesn't exist. Due to a bug, some database adapters (notably ZODBCDA) use a variant of the "Results" class that does not support "dictionaries"...
Dieter
participants (3)
-
Dieter Maurer -
Igor Leturia -
Peter Sabaini