Clean up some sqlite3 APIs

Recently, Argument Clinic learned how to deprecate passing parameters positionally and by keyword. As a start, we kicked it off by cleaning up the API of sqlite3.connect: positional use of optional sqlite3.connect parameters are deprecated as of Python 3.13; they will become keyword-only in 3.15.

Some years ago, the inconsistency of some other sqlite3 APIs was discussed. Mainly the inconsistency between documentation and the implementation was discussed, but the thought of making some APIs positional-only was brought up by @berkerpeksag.

I now suggest to clean up the following groups of sqlite3.Connection APIs (gh-108278)):

Create user-defined functions

Currently:

  • create_function(name, narg, func, *, deterministic=False)
  • create_aggregate(name, n_arg, aggregate_class)
  • create_window_function(name, num_params, aggregate_class, /)
  • create_collation(name, callable, /)

Proposal:

  • create_function(name, nargs, callable, /, *, deterministic=False)
  • create_aggregate(name, nargs, aggregate_class, /)
  • create_window_function(name, nargs, aggregate_class, /)
  • create_collation(name, callable, /)

Set callback APIs

Currently:

  • set_authorizer(authorizer_callback)
  • set_progress_handler(progress_handler, n)
  • set_trace_callback(trace_callback)

Proposal:

  • set_authorizer(authorizer_callback, /)
  • set_progress_handler(progress_handler, /, n)
  • set_trace_callback(trace_callback, /)

The new argument specs would come into effect in Python 3.15.

Throwing it out here, for more coverage :slight_smile:

2 Likes

For the record, gh-108281 has now landed in main, thereby deprecating passing any of the first three params in create_function and create_aggregate by keyword.

1 Like