From: Steve W. <go...@co...> - 2003-06-05 20:55:21
|
I may be misunderstanding the purpose of cursor.executemany(query, sequence_of_params) ... The doc says "Execute a query many times, once for each params in the sequence." I had hoped the results would accumulate in the cursor, but it doesn't appear to (perhaps I'm doing something wrong!). Here's what I'm doing: curs.executemany('select * from docs where doc_number = %s', docnums) in which docnums is a list of strings, which are values of doc_number. (I've verified that they are valid.) Then when I then do curs.fetchall() ... I get only the result of the execution of the query using the last item in the list (which is certainly what you get by doing several "execute(query, parms)" in succession). Is this the way it's supposed to work? And if so, what would be a good way of doing what I want to do (i.e., feed in a sequence of parameters and get back a cumulative result of executing the same query with each one)? Should I just loop over execute() calls in my code and do my own accumulation? TIA! Steve. |