@@ -258,7 +258,7 @@ Module functions and constants
258258 Can be ``"DEFERRED" `` (default), ``"EXCLUSIVE" `` or ``"IMMEDIATE" ``;
259259 or :const: `None ` to disable opening transactions implicitly.
260260 See :ref: `sqlite3-controlling-transactions ` for more.
261- :type isolation_level: str | None
261+ :type isolation_level: str | :const: ` None `
262262
263263 :param check_same_thread:
264264 If :const: `True ` (default), only the creating thread may use the connection.
@@ -288,7 +288,7 @@ Module functions and constants
288288 enabling various :ref: `sqlite3-uri-tricks `.
289289 :type uri: bool
290290
291- :rtype: sqlite3. Connection
291+ :rtype: Connection
292292
293293 .. audit-event :: sqlite3.connect database sqlite3.connect
294294 .. audit-event :: sqlite3.connect/handle connection_handle sqlite3.connect
@@ -423,21 +423,35 @@ Connection Objects
423423
424424 .. method :: create_function(name, narg, func, *, deterministic=False)
425425
426- Creates a user-defined function that you can later use from within SQL
427- statements under the function name *name *. *narg * is the number of
428- parameters the function accepts (if *narg * is -1, the function may
429- take any number of arguments), and *func * is a Python callable that is
430- called as the SQL function. If *deterministic * is true, the created function
431- is marked as `deterministic <https://sqlite.org/deterministic.html >`_, which
432- allows SQLite to perform additional optimizations. This flag is supported by
433- SQLite 3.8.3 or higher, :exc: `NotSupportedError ` will be raised if used
434- with older versions.
426+ Create or remove a user-defined SQL function.
435427
436- The function can return any of
437- :ref: `the types natively supported by SQLite <sqlite3-types >`.
428+ :param name:
429+ The name of the SQL function.
430+ :type name: str
438431
439- .. versionchanged :: 3.8
440- The *deterministic * parameter was added.
432+ :param narg:
433+ The number of arguments the SQL function can accept.
434+ If ``-1 ``, it may take any number of arguments.
435+ :type narg: int
436+
437+ :param func:
438+ A callable that is called when the SQL function is invoked.
439+ The callable must return :ref: `a type natively supported by SQLite
440+ <sqlite3-types>`.
441+ Set to :const: `None ` to remove an existing SQL function.
442+ :type func: :term: `callback ` | :const: `None `
443+
444+ :param deterministic:
445+ If :const: `True `, the created SQL function is marked as
446+ `deterministic <https://sqlite.org/deterministic.html >`_,
447+ which allows SQLite to perform additional optimizations.
448+ :type deterministic: bool
449+
450+ :raises NotSupportedError:
451+ If *deterministic * is used with SQLite versions older than 3.8.3.
452+
453+ .. versionadded :: 3.8
454+ The *deterministic * parameter.
441455
442456 Example:
443457
@@ -446,15 +460,29 @@ Connection Objects
446460
447461 .. method :: create_aggregate(name, /, n_arg, aggregate_class)
448462
449- Creates a user-defined aggregate function.
463+ Create or remove a user-defined SQL aggregate function.
464+
465+ :param name:
466+ The name of the SQL aggregate function.
467+ :type name: str
468+
469+ :param n_arg:
470+ The number of arguments the SQL aggregate function can accept.
471+ If ``-1 ``, it may take any number of arguments.
472+ :type n_arg: int
473+
474+ :param aggregate_class:
475+ A class must implement the following methods:
450476
451- The aggregate class must implement a ``step `` method, which accepts the number
452- of parameters *n_arg * (if *n_arg * is -1, the function may take
453- any number of arguments), and a ``finalize `` method which will return the
454- final result of the aggregate.
477+ * ``step() ``: Add a row to the aggregate.
478+ * ``finalize() ``: Return the final result of the aggregate as
479+ :ref: `a type natively supported by SQLite <sqlite3-types >`.
455480
456- The ``finalize `` method can return any of
457- :ref: `the types natively supported by SQLite <sqlite3-types >`.
481+ The number of arguments that the ``step() `` method must accept
482+ is controlled by *n_arg *.
483+
484+ Set to :const: `None ` to remove an existing SQL aggregate function.
485+ :type aggregate_class: :term: `class ` | :const: `None `
458486
459487 Example:
460488
@@ -643,29 +671,43 @@ Connection Objects
643671
644672 .. method :: backup(target, *, pages=-1, progress=None, name="main", sleep=0.250)
645673
646- This method makes a backup of an SQLite database even while it's being accessed
647- by other clients, or concurrently by the same connection. The copy will be
648- written into the mandatory argument *target *, that must be another
649- :class: `Connection ` instance.
650-
651- By default, or when *pages * is either ``0 `` or a negative integer, the entire
652- database is copied in a single step; otherwise the method performs a loop
653- copying up to *pages * pages at a time.
654-
655- If *progress * is specified, it must either be ``None `` or a callable object that
656- will be executed at each iteration with three integer arguments, respectively
657- the *status * of the last iteration, the *remaining * number of pages still to be
658- copied and the *total * number of pages.
659-
660- The *name * argument specifies the database name that will be copied: it must be
661- a string containing either ``"main" ``, the default, to indicate the main
662- database, ``"temp" `` to indicate the temporary database or the name specified
663- after the ``AS `` keyword in an ``ATTACH DATABASE `` statement for an attached
664- database.
665-
666- The *sleep * argument specifies the number of seconds to sleep by between
667- successive attempts to backup remaining pages, can be specified either as an
668- integer or a floating point value.
674+ Create a backup of an SQLite database.
675+
676+ Works even if the database is being accessed by other clients
677+ or concurrently by the same connection.
678+
679+ :param target:
680+ The database connection to save the backup to.
681+ :type target: Connection
682+
683+ :param pages:
684+ The number of pages to copy at a time.
685+ If equal to or less than ``0 ``,
686+ the entire database is copied in a single step.
687+ Defaults to ``-1 ``.
688+ :type pages: int
689+
690+ :param progress:
691+ If set to a callable, it is invoked with three integer arguments for
692+ every backup iteration:
693+ the *status * of the last iteration,
694+ the *remaining * number of pages still to be copied,
695+ and the *total * number of pages.
696+ Defaults to :const: `None `.
697+ :type progress: :term: `callback ` | :const:`None`
698+
699+ :param name:
700+ The name of the database to back up.
701+ Either ``"main" `` (the default) for the main database,
702+ ``"temp" `` for the temporary database,
703+ or the name of a custom database as attached using the
704+ ``ATTACH DATABASE `` SQL statment.
705+ :type name: str
706+
707+ :param sleep:
708+ The number of seconds to sleep between successive attempts
709+ to back up remaining pages.
710+ :type sleep: float
669711
670712 Example 1, copy an existing database into another::
671713
0 commit comments