[DB-SIG] PEP 249 clarification

Stefan C. Kremer skremer at uoguelph.ca
Wed Apr 21 20:00:02 CEST 2010


Hi,

The "fetchall()" command returns a list.  Lists are mutable objects in python.  Could a valid implementation return the same list object (with different contents) for multiple calls to fetchall() (with potentially different preceding execute queries)?

e.g.

cursor.execute( """SELECT * FROM table1;""" );
result = cursor.fetchall();
print result;

cursor.execute("""SELECT * FROM table2;""" );
junk = cursor.fetchall();
print result;

Is it possible, in a valid implementation, for the two print statements to generate different output (which would be the case if, for example, the fetchall method used an internal list which is a member variable of the cursor object in its return)?

It seems to me that it is important for implementors and users of a DBI to understand the implications of this.

Thanks,

	Stefan
--
Dr. Stefan C. Kremer
Dept. of Computing & Information Science
skremer at uoguelph.ca * 519-824-4120x58913



More information about the DB-SIG mailing list