[Python-checkins] [3.9] bpo-46261: Update `sqlite3.Cursor.lastrowid` docs (GH-30407)
taleinat
webhook-mailer at python.org
Sat Jan 8 15:06:18 EST 2022
https://github.com/python/cpython/commit/b29aa71090e4dd34900660ecca8bb62667440f41
commit: b29aa71090e4dd34900660ecca8bb62667440f41
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: taleinat <532281+taleinat at users.noreply.github.com>
date: 2022-01-08T22:06:14+02:00
summary:
[3.9] bpo-46261: Update `sqlite3.Cursor.lastrowid` docs (GH-30407)
files:
M Doc/library/sqlite3.rst
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index 3f4f8536c1c6b..0ffb8ff0b969c 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -756,14 +756,15 @@ Cursor Objects
.. attribute:: lastrowid
- This read-only attribute provides the rowid of the last modified row. It is
- only set if you issued an ``INSERT`` or a ``REPLACE`` statement using the
- :meth:`execute` method. For operations other than ``INSERT`` or
- ``REPLACE`` or when :meth:`executemany` is called, :attr:`lastrowid` is
- set to :const:`None`.
-
- If the ``INSERT`` or ``REPLACE`` statement failed to insert the previous
- successful rowid is returned.
+ This read-only attribute provides the row id of the last inserted row. It
+ is only updated after successful ``INSERT`` or ``REPLACE`` statements
+ using the :meth:`execute` method. For other statements, after
+ :meth:`executemany` or :meth:`executescript`, or if the insertion failed,
+ the value of ``lastrowid`` is left unchanged. The initial value of
+ ``lastrowid`` is :const:`None`.
+
+ .. note::
+ Inserts into ``WITHOUT ROWID`` tables are not recorded.
.. versionchanged:: 3.6
Added support for the ``REPLACE`` statement.
More information about the Python-checkins
mailing list