diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-09-15 12:00:02 -0700 |
---|---|---|
committer | Pablo Galindo <pablogsal@gmail.com> | 2021-09-29 12:34:21 +0100 |
commit | 6fc66d6b9d39fa7a5a8692062d54b5a6a1aa0283 (patch) | |
tree | 8aa8948509b1e03fb6d23ee96caebf50575be8df | |
parent | b1873d1e24ed5ef39f37ca3090c2f0c2b34ce23f (diff) | |
download | cpython-git-6fc66d6b9d39fa7a5a8692062d54b5a6a1aa0283.tar.gz |
bpo-45089: Improve sqlite3 trace callback docs (GH-28238) (GH-28371)
- Add link to str object and sqlite3 transaction control
- Mention that exceptions are not propagated
(cherry picked from commit 51056b40e711d84692d099ac8970077b33c7fafd)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
-rw-r--r-- | Doc/library/sqlite3.rst | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index dec0092f11..d29e425cb9 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -451,14 +451,22 @@ Connection Objects Registers *trace_callback* to be called for each SQL statement that is actually executed by the SQLite backend. - The only argument passed to the callback is the statement (as string) that - is being executed. The return value of the callback is ignored. Note that - the backend does not only run statements passed to the :meth:`Cursor.execute` - methods. Other sources include the transaction management of the Python - module and the execution of triggers defined in the current database. + The only argument passed to the callback is the statement (as + :class:`str`) that is being executed. The return value of the callback is + ignored. Note that the backend does not only run statements passed to the + :meth:`Cursor.execute` methods. Other sources include the + :ref:`transaction management <sqlite3-controlling-transactions>` of the + sqlite3 module and the execution of triggers defined in the current + database. Passing :const:`None` as *trace_callback* will disable the trace callback. + .. note:: + Exceptions raised in the trace callback are not propagated. As a + development and debugging aid, use + :meth:`~sqlite3.enable_callback_tracebacks` to enable printing + tracebacks from exceptions raised in the trace callback. + .. versionadded:: 3.3 |