[Python-checkins] [3.11] gh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (#104287) (#104381)

erlend-aasland webhook-mailer at python.org
Thu May 11 05:10:11 EDT 2023


https://github.com/python/cpython/commit/705508850026dd13121b469290e27c29bd8ef20c
commit: 705508850026dd13121b469290e27c29bd8ef20c
branch: 3.11
author: Erlend E. Aasland <erlend.aasland at protonmail.com>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2023-05-11T11:09:46+02:00
summary:

[3.11] gh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (#104287) (#104381)

The SQLite C API sqlite3_changes() can only be relied upon when the
current active statement has been run to completion.

files:
M Doc/library/sqlite3.rst

diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index 4dbbfe21ff66..249d29ce8993 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -1516,7 +1516,10 @@ Cursor objects
       ``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements;
       is ``-1`` for other statements,
       including :abbr:`CTE (Common Table Expression)` queries.
-      It is only updated by the :meth:`execute` and :meth:`executemany` methods.
+      It is only updated by the :meth:`execute` and :meth:`executemany` methods,
+      after the statement has run to completion.
+      This means that any resulting rows must be fetched in order for
+      :attr:`!rowcount` to be updated.
 
    .. attribute:: row_factory
 



More information about the Python-checkins mailing list