Adding to Zsql method result object
I have a query returning data from the zsql method. How can I append to the results object that I receive. Lets say I select a,b,c from mytable I get a results object . from my use/reading of this it is a list of dictionaries ... I thought that I could do this to append a new row myrow = dict([('a','1'),('b','2'),('c','3')]) aData=aData,myrow But alas I get an error: AttributeError: 'tuple' object has no attribute 'dictionaries' Could anyone shed some light on this please, not so much the error as I understand that ... But how I can do append a row to this data structure. ____________________________________________ Peter Millar
Peter Millar wrote:
I have a query returning data from the zsql method.
How can I append to the results object that I receive.
Lets say I select a,b,c from mytable
I get a results object . from my use/reading of this it is a list of dictionaries ...
No, it is an object that emulates a tuple of "brain records". It stores raw records (tuples/lists?) + query schema information + a class object and implements lazy instantiation of records. Results objects have a dictionaries() method that returns a list of dictionaries. For more details take a look at $ZOPE/lib/python/Shared/DC/ZRDB/Results.py. HTH -- //// (@ @) ----------------------------oOO----(_)----OOo-------------------------- <> Ojo por ojo y el mundo acabara ciego /\ Alexis Roda - Universitat Rovira i Virgili - Reus, Tarragona (Spain) -----------------------------------------------------------------------
participants (2)
-
Alexis Roda -
Peter Millar