Skip to content

[3.9] bpo-46261: Update sqlite3.Cursor.lastrowid docs (GH-30407) #30488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Doc/library/sqlite3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down