Skip to content

Commit 7470321

Browse files
gh-101117: Improve accuracy of sqlite3.Cursor.rowcount docs (#104287)
The SQLite C API sqlite3_changes() can only be relied upon when the current active statement has been run to completion.
1 parent 4abfe6a commit 7470321

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Doc/library/sqlite3.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,10 @@ Cursor objects
16941694
``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements;
16951695
is ``-1`` for other statements,
16961696
including :abbr:`CTE (Common Table Expression)` queries.
1697-
It is only updated by the :meth:`execute` and :meth:`executemany` methods.
1697+
It is only updated by the :meth:`execute` and :meth:`executemany` methods,
1698+
after the statement has run to completion.
1699+
This means that any resulting rows must be fetched in order for
1700+
:attr:`!rowcount` to be updated.
16981701

16991702
.. attribute:: row_factory
17001703

0 commit comments

Comments
 (0)