On 3/10/11 9:16 AM, Ed Leafe wrote:
> On Mar 10, 2011, at 12:09 PM, Paul McNett wrote:
>
>> Actually, I think this is database independent. I think you are correct for 
>> MySQL,
>> but for others fetchmany() will just get that many rows from the backend.
>
>       ???
>
>       Read PEP249: http://www.python.org/dev/peps/pep-0249/
>
>       .fetchone(), .fetchmany() and .fetchall() work on the dbapi cursor's 
> result set *after* a call to .execute() has retrieved rows of data from the 
> database.

When I read PEP249, in the .execute(), .fetch*() and .arraysize() 
specifications, I 
see nothing about .execute() retrieving rows from the database. It prepares and 
executes them on the database.

The implication (for me) in the PEP is that .fetch*() gets the row(s) from the 
database and returns them to the caller. Depending on how it is implemented, 
this 
could result in good performance because:

1) the query is only executed once
2) a small set of rows is retrieved for each .fetch*() call, and all records 
may 
never be fetched.

I don't actually know (but will try to find time to test) how each adapter is 
implemented. It could be that they are all implemented in your interpretation 
of the 
PEP, and not mine.

Paul

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]

Reply via email to