diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index a7581f2fcbd8c0..b92e123bddc677 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -396,7 +396,7 @@ Module functions and constants .. _sqlite3-connection-objects: -Connection Objects +Connection objects ------------------ .. class:: Connection @@ -865,7 +865,7 @@ Connection Objects .. _sqlite3-cursor-objects: -Cursor Objects +Cursor objects -------------- .. class:: Cursor @@ -1021,7 +1021,7 @@ Cursor Objects .. _sqlite3-row-objects: -Row Objects +Row objects ----------- .. class:: Row @@ -1087,7 +1087,7 @@ Now we plug :class:`Row` in:: .. _sqlite3-blob-objects: -Blob Objects +Blob objects ------------ .. versionadded:: 3.11 @@ -1139,7 +1139,7 @@ Blob Objects end). -PrepareProtocol Objects +PrepareProtocol objects ----------------------- .. class:: PrepareProtocol @@ -1291,8 +1291,8 @@ you can let the :mod:`sqlite3` module convert SQLite types to different Python types via converters. -Using adapters to store custom Python types in SQLite databases -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +How to adapt custom Python types to SQLite values +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SQLite supports only a limited set of data types natively. To store custom Python types in SQLite databases, *adapt* them to one of the @@ -1309,8 +1309,8 @@ registering custom adapter functions. .. _sqlite3-conform: -Letting your object adapt itself -"""""""""""""""""""""""""""""""" +Let your object adapt itself +"""""""""""""""""""""""""""" Suppose we have a ``Point`` class that represents a pair of coordinates, ``x`` and ``y``, in a Cartesian coordinate system. @@ -1323,8 +1323,8 @@ The object passed to *protocol* will be of type :class:`PrepareProtocol`. .. literalinclude:: ../includes/sqlite3/adapter_point_1.py -Registering an adapter callable -""""""""""""""""""""""""""""""" +Use an adapter callable +""""""""""""""""""""""" The other possibility is to create a function that converts the Python object to an SQLite-compatible type. @@ -1335,8 +1335,8 @@ This function can then be registered using :func:`register_adapter`. .. _sqlite3-converters: -Converting SQLite values to custom Python types -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +How to convert SQLite values to custom Python types +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Writing an adapter lets you convert *from* custom Python types *to* SQLite values. @@ -1412,7 +1412,7 @@ The deprecated default adapters and converters consist of: .. _sqlite3-adapter-converter-recipes: -Adapter and Converter Recipes +Adapter and converter recipes ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This section shows recipes for common adapters and converters. @@ -1457,8 +1457,8 @@ This section shows recipes for common adapters and converters. .. _sqlite3-controlling-transactions: -Controlling Transactions ------------------------- +Transaction control +------------------- The ``sqlite3`` module does not adhere to the transaction handling recommended by :pep:`249`. @@ -1528,12 +1528,13 @@ can be found in the `SQLite URI documentation`_. .. _SQLite URI documentation: https://www.sqlite.org/uri.html -Using :mod:`sqlite3` efficiently --------------------------------- +How to use ``sqlite3`` efficiently +---------------------------------- -Using shortcut methods -^^^^^^^^^^^^^^^^^^^^^^ + +How to use shortcut methods +^^^^^^^^^^^^^^^^^^^^^^^^^^^ Using the nonstandard :meth:`execute`, :meth:`executemany` and :meth:`executescript` methods of the :class:`Connection` object, your code can @@ -1546,8 +1547,8 @@ directly using only a single call on the :class:`Connection` object. .. literalinclude:: ../includes/sqlite3/shortcut_methods.py -Accessing columns by name instead of by index -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +How to access columns by name +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ One useful feature of the :mod:`sqlite3` module is the built-in :class:`sqlite3.Row` class designed to be used as a row factory. @@ -1560,8 +1561,8 @@ case-insensitively by name: .. _sqlite3-connection-context-manager: -Using the connection as a context manager -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +How to use a connection as a context manager +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A :class:`Connection` object can be used as a context manager that automatically commits or rolls back open transactions when leaving the body of