Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#29940 closed Cleanup/optimization (fixed)

Update "Performing raw SQL queries" doc to recommend not using raw()

Reported by: Katie McLaughlin Owned by: nobody
Component: Documentation Version: 2.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

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

Change History (3)

comment:1 by Tim Graham, 5 years ago

Has patch: set
Patch needs improvement: set
Summary: Update "Performing raw SQL queries" doc in 2.1 to recommend not using raw()Update "Performing raw SQL queries" doc to recommend not using raw()
Triage Stage: UnreviewedAccepted

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.

comment:2 by Tim Graham <timograham@…>, 5 years ago

Resolution: fixed
Status: newclosed

In 9886dffd:

Fixed #29940 -- Recommended using the ORM rather than raw SQL.

comment:3 by Tim Graham <timograham@…>, 5 years ago

In 353afec7:

[2.1.x] Fixed #29940 -- Recommended using the ORM rather than raw SQL.

Backport of 9886dffdf45873a5ce427eded9277f37d4a30ef1 from master.

Note: See TracTickets for help on using tickets.
Back to Top