python / python/cpython

Bad advice in DeprecationWarning about sqlite3 datetime adapter

Open
#135,834 0 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

docs topic-sqlite3
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

When using the datetime adapter of sqlite3, you'll get:

DeprecationWarning: The default datetime adapter is deprecated as of Python 3.12; see the sqlite3 documentation for suggested replacement recipes

The relevant documentation likely is located at https://docs.python.org/3/library/sqlite3.html#default-adapters-and-converters-deprecated

The suggested recipe likely is https://docs.python.org/3/library/sqlite3.html#sqlite3-adapter-converter-recipes

This recipe suggests modifying global state in the sqlite3 module. This is a no-go for libraries as two libraries registering adapters would quickly run into a conflict.

Please offer a recipe suitable for use in libraries or undeprecate the default adapters.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the sqlite3 documentation sections on default adapters and converters and the adapter/converter recipes linked in the issue. Examine whether the suggested recipe's global registration is suitable for library code, then determine whether the documentation needs a library-safe recipe or whether the deprecation should be reconsidered. Done means the requested guidance or deprecation decision is clearly reflected in the sqlite3 documentation and supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
databases, documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.