python / python/cpython

Build SQLite with SQLITE_ENABLE_PERCENTILE for Windows and CPython-3.15+

Open
#152,023 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extension-modules topic-sqlite3 type-feature
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Feature or enhancement

Proposal:

For Windows, CPython-3.15 requires SQLite-3.53.2. Since 3.51.0, the aggregate functions median and percentile are part of SQLite's amalgamation. I believe that this means that they are found to be mature. To have them available at run-time, SQLite needs to be built with SQLITE_ENABLE_PERCENTILE. Python's PCBuild activates a few built-in extensions of SQLite, but not this one yet.
Inserting SQLITE_ENABLE_PERCENTILE here might be everything needed.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

I have not found previous discussions on this topic.

This discussion is about the ability to load SQLite extension modules at run-time, which is somehow related, as it can be used as an (inconvenient) fallback.

Another fallback is to implement these statistical functions in Python and bind them to a data base connection. This works, but is slower than having them built into SQLite (76s vs. 68s in my non-repesentative query).

Linked PRs
  • gh-153867
  • gh-153869
  • gh-155101
  • gh-156048
  • gh-156446
  • gh-156448

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 PCbuild/sqlite3.vcxproj at the SQLite compile definitions referenced in the issue, and inspect how CPython enables SQLite extensions for Windows. Verify the Windows build exposes SQLite's median and percentile functions at runtime, using the linked PRs to understand the current implementation and validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
build-system, databases
Issue type
Feature
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.