This project is archived and is in readonly mode.
Executemany fails on non-insert VALUES statements
-
Daniele Varrazzo
- Tag set to executemany, rel-2.4.5
It is surprising that it returns a list of values. executemany shouldn't be called with statements returning rows, only with data manipulation commands: as per DBAPI specs all the results should be discarded.
Looks we build a list as long as the # of records passed, which is bad as they may be a lot. The tuple in the first item is the result of the last statement.
In [11]: cur.executemany("select %s, %s", [(i,i) for i in range(3)]) In [12]: cur.fetchall() Out[12]: [(2, 2), (None, None), (None, None)]We may clean this up a little bit, but the result should be that fetch returns no record after executemany, not that you'll be able to see each query's result.
-
Daniele Varrazzo
- State changed from new to resolved
Fixed in my devel: after executemany() there is no result to fetch on the cursor (we discard the result from the db and save the time to process it into python objects).