[Django] #32346: Expose ROW_NUMBER functionality.

9 views
Skip to first unread message

Django

unread,
Jan 12, 2021, 6:24:24 PM1/12/21
to django-...@googlegroups.com
#32346: Expose ROW_NUMBER functionality.
-------------------------------------+-------------------------------------
Reporter: Stuart | Owner: nobody
Axon |
Type: New | Status: new
feature |
Component: Database | Version: 3.1
layer (models, ORM) | Keywords: row_number,
Severity: Normal | iterator
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
ROW_NUMBER opens up possibilities for users to optimise queries.

It is supported in all the major databases:

Oracle: ROW_NUMBER
Postgres: ROW_NUMBER
MYSQL: ROW_NUMBER since 8.0
Sqlite: ROW_NUMBER since 3.25.0
MSSQL: ROW_NUMBER all supported versions

Supporting it would help in use cases where the user is building records
that currently use python enumerate.

I'm not sure what a django-esque name would be, there are probably better
ones than row_number.

--
Ticket URL: <https://code.djangoproject.com/ticket/32346>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 12, 2021, 10:31:07 PM1/12/21
to django-...@googlegroups.com
#32346: Expose ROW_NUMBER functionality.
-------------------------------------+-------------------------------------
Reporter: Stuart Axon | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: row_number, | Triage Stage:
iterator | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

* status: new => closed
* resolution: => invalid


Comment:

It's already supported using the `RowNumber`
[https://docs.djangoproject.com/en/3.1/ref/models/database-functions/
database function since Django 2.0].

https://github.com/django/django/blob/4c62cdaa1041d49d0b46f6cef5f4618f020fff29/django/db/models/functions/window.py#L105-L108

--
Ticket URL: <https://code.djangoproject.com/ticket/32346#comment:1>

Django

unread,
Jan 13, 2021, 5:57:26 AM1/13/21
to django-...@googlegroups.com
#32346: Expose ROW_NUMBER functionality.
-------------------------------------+-------------------------------------
Reporter: Stuart Axon | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: row_number, | Triage Stage:
iterator | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Stuart Axon):

Thanks, I missed this somehow.

--
Ticket URL: <https://code.djangoproject.com/ticket/32346#comment:2>

Reply all
Reply to author
Forward
0 new messages