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

Skip Montanaro skip.montanaro at gmail.com
Wed May 31 08:04:56 EDT 2017


Well, you can't do that, because you can't iterate over an execute().
You would do:

    cur.execute("SELECT ...")
    for row1 in cur.fetchall():
        cur.execute("SELECT ...")
        for row2 in cur.fetchall():
            ....


Whoops, yeah. I think one of the adapters at my disposal at work (maybe one
layered on top of pyodbc) allows me to do that. I get confused. Never just
type (pseudo) code into an email message...

Skip



More information about the Python-list mailing list