Skip to content

Commit b6aa38f

Browse files
author
Erlend Egeberg Aasland
authored
bpo-46261: Update sqlite3.Cursor.lastrowid docs (GH-30407)
1 parent ef5376e commit b6aa38f

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Doc/library/sqlite3.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -845,14 +845,15 @@ Cursor Objects
845845

846846
.. attribute:: lastrowid
847847

848-
This read-only attribute provides the rowid of the last modified row. It is
849-
only set if you issued an ``INSERT`` or a ``REPLACE`` statement using the
850-
:meth:`execute` method. For operations other than ``INSERT`` or
851-
``REPLACE`` or when :meth:`executemany` is called, :attr:`lastrowid` is
852-
set to :const:`None`.
853-
854-
If the ``INSERT`` or ``REPLACE`` statement failed to insert the previous
855-
successful rowid is returned.
848+
This read-only attribute provides the row id of the last inserted row. It
849+
is only updated after successful ``INSERT`` or ``REPLACE`` statements
850+
using the :meth:`execute` method. For other statements, after
851+
:meth:`executemany` or :meth:`executescript`, or if the insertion failed,
852+
the value of ``lastrowid`` is left unchanged. The initial value of
853+
``lastrowid`` is :const:`None`.
854+
855+
.. note::
856+
Inserts into ``WITHOUT ROWID`` tables are not recorded.
856857

857858
.. versionchanged:: 3.6
858859
Added support for the ``REPLACE`` statement.

0 commit comments

Comments
 (0)