[issue46249] [sqlite3] move set lastrowid out of the query loop

Erlend E. Aasland report at bugs.python.org
Tue Jan 4 05:02:55 EST 2022


Erlend E. Aasland <erlend.aasland at innova.no> added the comment:

Thank you for your input Marc-André.

For SQLite, it's pretty simple: we use an API called sqlite3_last_insert_rowid() which takes the database connection as it's argument, not a statement pointer. This function returns "the rowid of the most recent successful INSERT into a rowid table or virtual table on database connection" (quote from SQLite docs). IMO, it would make sense to also use this post executemany().

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46249>
_______________________________________


More information about the Python-bugs-list mailing list