[Django] #29940: Update "Performing raw SQL queries" doc in 2.1 to recommend not using raw()

4 views
Skip to first unread message

Django

unread,
Nov 9, 2018, 4:30:14 PM11/9/18
to django-...@googlegroups.com
#29940: Update "Performing raw SQL queries" doc in 2.1 to recommend not using raw()
------------------------------------------------+------------------------
Reporter: Katie McLaughlin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 2.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
The documentation on this page is 5-10 years old and doesn't reflect the
current state of the ORM, where there shouldn't be a reason to drop to
raw() SQL any more, given annotations, aggregation, explain plans and
custom query expressions.

It should be updated to have above the fold: "Don't do this". But until
`raw()` is completely removed, the page should detail how to do it.

I'll submit a PR to do just this, but I would appreciate a second opinion
on how best to word/present this.


https://docs.djangoproject.com/en/2.1/topics/db/sql/

Reference talk: https://youtu.be/p9Bgr5VOISo?t=1433

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

Django

unread,
Nov 9, 2018, 6:43:27 PM11/9/18
to django-...@googlegroups.com
#29940: Update "Performing raw SQL queries" doc to recommend not using raw()
--------------------------------------+------------------------------------

Reporter: Katie McLaughlin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 2.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

[https://github.com/django/django/pull/10632 PR]

I agree with what Simon said on the ticket. There are still use cases for
`raw()` and it's not likely to be deprecated.

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

Django

unread,
Nov 13, 2018, 6:15:53 PM11/13/18
to django-...@googlegroups.com
#29940: Update "Performing raw SQL queries" doc to recommend not using raw()
--------------------------------------+------------------------------------

Reporter: Katie McLaughlin | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 2.1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

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


Comment:

In [changeset:"9886dffdf45873a5ce427eded9277f37d4a30ef1" 9886dffd]:
{{{
#!CommitTicketReference repository=""
revision="9886dffdf45873a5ce427eded9277f37d4a30ef1"
Fixed #29940 -- Recommended using the ORM rather than raw SQL.
}}}

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

Django

unread,
Nov 13, 2018, 6:16:04 PM11/13/18
to django-...@googlegroups.com
#29940: Update "Performing raw SQL queries" doc to recommend not using raw()
--------------------------------------+------------------------------------

Reporter: Katie McLaughlin | Owner: nobody
Type: Cleanup/optimization | Status: closed
Component: Documentation | Version: 2.1

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"353afec70d8d60fac8699bbd3ab10efa96ee41f9" 353afec7]:
{{{
#!CommitTicketReference repository=""
revision="353afec70d8d60fac8699bbd3ab10efa96ee41f9"
[2.1.x] Fixed #29940 -- Recommended using the ORM rather than raw SQL.

Backport of 9886dffdf45873a5ce427eded9277f37d4a30ef1 from master.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29940#comment:3>

Reply all
Reply to author
Forward
0 new messages