gh-133595: Clean up sqlite3.Connection APIs (GH-133605) · python/cpython@dcf93c4

GitHub

@@ -259,10 +259,10 @@ Reference

259259Module functions

260260^^^^^^^^^^^^^^^^

261261262-.. function:: connect(database, timeout=5.0, detect_types=0, \

262+.. function:: connect(database, *, timeout=5.0, detect_types=0, \

263263 isolation_level="DEFERRED", check_same_thread=True, \

264264 factory=sqlite3.Connection, cached_statements=128, \

265- uri=False, *, \

265+ uri=False, \

266266 autocommit=sqlite3.LEGACY_TRANSACTION_CONTROL)

267267268268 Open a connection to an SQLite database.

@@ -355,11 +355,8 @@ Module functions

355355 .. versionchanged:: 3.12

356356 Added the *autocommit* parameter.

357357358- .. versionchanged:: 3.13

359- Positional use of the parameters *timeout*, *detect_types*,

360- *isolation_level*, *check_same_thread*, *factory*, *cached_statements*,

361- and *uri* is deprecated.

362- They will become keyword-only parameters in Python 3.15.

358+ .. versionchanged:: 3.15

359+ All parameters except *database* are now keyword-only.

363360364361.. function:: complete_statement(statement)

365362@@ -693,7 +690,7 @@ Connection objects

693690:meth:`~Cursor.executescript` on it with the given *sql_script*.

694691 Return the new cursor object.

695692696- .. method:: create_function(name, narg, func, *, deterministic=False)

693+ .. method:: create_function(name, narg, func, /, *, deterministic=False)

697694698695 Create or remove a user-defined SQL function.

699696@@ -719,6 +716,9 @@ Connection objects

719716 .. versionchanged:: 3.8

720717 Added the *deterministic* parameter.

721718719+ .. versionchanged:: 3.15

720+ The first three parameters are now positional-only.

721+722722 Example:

723723724724 .. doctest::

@@ -733,13 +733,8 @@ Connection objects

733733('acbd18db4cc2f85cedef654fccc4a4d8',)

734734 >>> con.close()

735735736- .. versionchanged:: 3.13

737-738- Passing *name*, *narg*, and *func* as keyword arguments is deprecated.

739- These parameters will become positional-only in Python 3.15.

740-741736742- .. method:: create_aggregate(name, n_arg, aggregate_class)

737+ .. method:: create_aggregate(name, n_arg, aggregate_class, /)

743738744739 Create or remove a user-defined SQL aggregate function.

745740@@ -763,6 +758,9 @@ Connection objects

763758 Set to ``None`` to remove an existing SQL aggregate function.

764759:type aggregate_class::term:`class` | None

765760761+ .. versionchanged:: 3.15

762+ All three parameters are now positional-only.

763+766764 Example:

767765768766 .. testcode::

@@ -792,11 +790,6 @@ Connection objects

792790793791 3

794792795- .. versionchanged:: 3.13

796-797- Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is deprecated.

798- These parameters will become positional-only in Python 3.15.

799-800793801794 .. method:: create_window_function(name, num_params, aggregate_class, /)

802795@@ -937,7 +930,7 @@ Connection objects

937930 Aborted queries will raise an :exc:`OperationalError`.

938931939932940- .. method:: set_authorizer(authorizer_callback)

933+ .. method:: set_authorizer(authorizer_callback, /)

941934942935 Register :term:`callable` *authorizer_callback* to be invoked

943936 for each attempt to access a column of a table in the database.

@@ -962,12 +955,11 @@ Connection objects

962955 .. versionchanged:: 3.11

963956 Added support for disabling the authorizer using ``None``.

964957965- .. versionchanged:: 3.13

966- Passing *authorizer_callback* as a keyword argument is deprecated.

967- The parameter will become positional-only in Python 3.15.

958+ .. versionchanged:: 3.15

959+ The only parameter is now positional-only.

968960969961970- .. method:: set_progress_handler(progress_handler, n)

962+ .. method:: set_progress_handler(progress_handler, /, n)

971963972964 Register :term:`callable` *progress_handler* to be invoked for every *n*

973965 instructions of the SQLite virtual machine. This is useful if you want to

@@ -981,12 +973,11 @@ Connection objects

981973 currently executing query and cause it to raise a :exc:`DatabaseError`

982974 exception.

983975984- .. versionchanged:: 3.13

985- Passing *progress_handler* as a keyword argument is deprecated.

986- The parameter will become positional-only in Python 3.15.

976+ .. versionchanged:: 3.15

977+ The first parameter is now positional-only.

987978988979989- .. method:: set_trace_callback(trace_callback)

980+ .. method:: set_trace_callback(trace_callback, /)

990981991982 Register :term:`callable` *trace_callback* to be invoked

992983 for each SQL statement that is actually executed by the SQLite backend.

@@ -1009,9 +1000,8 @@ Connection objects

1009100010101001 .. versionadded:: 3.3

101110021012- .. versionchanged:: 3.13

1013- Passing *trace_callback* as a keyword argument is deprecated.

1014- The parameter will become positional-only in Python 3.15.

1003+ .. versionchanged:: 3.15

1004+ The first parameter is now positional-only.

101510051016100610171007 .. method:: enable_load_extension(enabled, /)