Repository navigation
Add create_window_function() to sqlite3.Connection #79097
Description
Activity
sqlite-3.25 now includes window functions, something very important in modern SQL.
https://www.sqlite.org/windowfunctions.html
Could it be included in next Python maintenance release ?
To completely do this requires two things:
-
Upgrade SQLite included in a number of binary distributions
-
Update the sqlite extension to allow creating custom window functions in Python
The latter is definitely something that cannot be done in a maintenance release. The former is up to the release managers.
-
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Oct 9, 2018 hum. On Windows at least, just drop-in replace the sqlite3.dll per the new sqlite-3.25 dll and the window functions just works.
==> I don't see the need for your latter point, at least on Windows.checked with sqlite_bro on Python-3.6.7rc1 with example:
CREATE TABLE t2(a, b);
INSERT INTO t2 VALUES('a', 'one'),
('a', 'two'),
('a', 'three'),
('b', 'four'),
('c', 'five'),
('c', 'six');
SELECT a AS a,
row_number() OVER win AS row_number,
rank() OVER win AS rank,
dense_rank() OVER win AS dense_rank,
percent_rank() OVER win AS percent_rank,
cume_dist() OVER win AS cume_dist
FROM t2
WINDOW win AS (ORDER BY a);My latter points makes it possible to define custom windowing functions in Python, similar to how it is already possible to define other SQLite functions in Python.
Due to the SQLite "Magellan" bug, I'd suggest this be 3.26+.
Details: https://blade.tencent.com/magellan/index_en.html
See also: https://bugs.python.org/issue35360bpo-35360 will cover updating our Windows and macOS installers. I'm retargeting this issue to add a create_window_function() method to the Connection object. I already have a WIP branch and am going to submit a PR later this weekend.
- added3.8 (EOL)end of lifeend of lifeextension-modulesC modules in the Modules dirC modules in the Modules dir
on May 11, 2019 - changed the title
[-]include sqlite-3.25+ (with window functions)[/-][+]Add create_window_function() to sqlite3.Connection[/+]on May 11, 2019 - addedtype-featureA feature request or enhancementA feature request or enhancementand removedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on May 11, 2019 I've implemented this in a fork / standalone packaging of the Python 3.x sqlite3 module. You can find the relevant portions (and a couple unrelated changes) in this commit:
Berker, are you still working on this? If not, I've got a proof-of-concept version of this w/unit tests ready for review. If you'd like to have a look at it, I can create a draft PR.
- added a commit that references this issue
on Apr 12, 2022
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: