summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-07-22 07:43:12 (GMT)
committerGitHub <noreply@github.com>2022-07-22 07:43:12 (GMT)
commit12b56e4b78a68b06f7e64aa349218f75ebb75ee6 (patch)
treedd2d583062c8147204e9a9b6c3fbf988a374eb12
parenta61aa529654b54e6dfee6ecf4bd61e8266c9ac30 (diff)
downloadcpython-12b56e4b78a68b06f7e64aa349218f75ebb75ee6.zip
cpython-12b56e4b78a68b06f7e64aa349218f75ebb75ee6.tar.gz
cpython-12b56e4b78a68b06f7e64aa349218f75ebb75ee6.tar.bz2
gh-81040: Improve sqlite3.Cursor.rowcount docs (GH-94940)
(cherry picked from commit f9b3706df65c4962646587b437a4eb39289dfd4c) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
-rw-r--r--Doc/library/sqlite3.rst17
1 files changed, 5 insertions, 12 deletions
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst
index 9da7b54..28f3b32 100644
--- a/Doc/library/sqlite3.rst
+++ b/Doc/library/sqlite3.rst
@@ -956,18 +956,11 @@ Cursor Objects
.. attribute:: rowcount
- Although the :class:`Cursor` class of the :mod:`sqlite3` module implements this
- attribute, the database engine's own support for the determination of "rows
- affected"/"rows selected" is quirky.
-
- For :meth:`executemany` statements, the number of modifications are summed up
- into :attr:`rowcount`.
-
- As required by the Python DB API Spec, the :attr:`rowcount` attribute "is -1 in
- case no ``executeXX()`` has been performed on the cursor or the rowcount of the
- last operation is not determinable by the interface". This includes ``SELECT``
- statements because we cannot determine the number of rows a query produced
- until all rows were fetched.
+ Read-only attribute that provides the number of modified rows for
+ ``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.
.. attribute:: lastrowid