]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45089: Improve sqlite3 trace callback docs (GH-28238)
authorErlend Egeberg Aasland <erlend.aasland@innova.no>
Wed, 15 Sep 2021 18:39:05 +0000 (20:39 +0200)
committerGitHub <noreply@github.com>
Wed, 15 Sep 2021 18:39:05 +0000 (20:39 +0200)
- Add link to str object and sqlite3 transaction control
- Mention that exceptions are not propagated

Doc/library/sqlite3.rst

index 7c60188bc70b59b8da297a4ff94a0e04fde51a7d..9c9c7f1eb52573ee4116357bd022c2a994dc9db0 100644 (file)
@@ -460,14 +460,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