Python DB API - commit() v. execute("commit transaction")?

Chris Angelico rosuav at gmail.com
Thu Jun 1 06:26:28 EDT 2017


On Thu, Jun 1, 2017 at 8:05 PM, Gregory Ewing
<greg.ewing at canterbury.ac.nz> wrote:
> A while back I wrote a dedicated wrapper around the Firebird
> API (I wasn't impressed by the DB API, for many of the reasons
> being discussed here), and this is almost exactly how I structured
> it. Except I didn't really have cursors as an explicit concept at
> all -- executing a query just gave you an object that you iterate
> over to get the results. It just seemed the most Pythonic way to
> do it.

Executing a query gives you some sort of object. That object either
contains all the results, or has the resource handle (or whatever)
needed to fetch more from the back end. That basically makes it a
cursor, so we're not far different after all :)

ChrisA



More information about the Python-list mailing list