[Django] #25326: Add an example with namedtuple to "Executing custom SQL directly"

6 views
Skip to first unread message

Django

unread,
Aug 29, 2015, 10:53:34 AM8/29/15
to django-...@googlegroups.com
#25326: Add an example with namedtuple to "Executing custom SQL directly"
-------------------------------+--------------------
Reporter: dodobas | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Namedtuples can be used to provide more convenient access for custom SQL
Results. This PR adds an example for namedtuple wrapper function and shows
differences between normal (tuple), dict and namedtuple wrapper functions.

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

Django

unread,
Aug 29, 2015, 10:59:03 AM8/29/15
to django-...@googlegroups.com
#25326: Add an example with namedtuple to "Executing custom SQL directly"
-------------------------------+--------------------------------------

Reporter: dodobas | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Pull request: https://github.com/django/django/pull/5206

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

Django

unread,
Aug 29, 2015, 11:10:11 AM8/29/15
to django-...@googlegroups.com
#25326: Add an example with namedtuple to "Executing custom SQL directly"
-------------------------------+--------------------------------------

Reporter: dodobas | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

Comment (by dodobas):

Couple of remarks:
* examples are Python2 as `'id': 54360982L`, in Python3 all integers are
implemented as `long` integers and as we are pushing Python3, we should
probably change it
* as `cursors` are iterable examples could be improved in a way to not use
`fetchall()` but return a generator, and then use list comprehensions to
actually ''show'' the difference between approaches

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

Django

unread,
Aug 29, 2015, 1:13:38 PM8/29/15
to django-...@googlegroups.com
#25326: Add an example with namedtuple to "Executing custom SQL directly"
-------------------------------+------------------------------------
Reporter: dodobas | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: master
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 timgraham):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* type: Uncategorized => New feature
* stage: Unreviewed => Accepted


Comment:

Looks reasonable, but docs should assume Python 3. Haven't taken time to
understand point 2, but if you want to make those updates as a separate
commit, I'll take a look. After you make the updates, please uncheck
"Patch needs improvement" on the ticket so it returns to the review queue.
Thanks!

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

Django

unread,
Aug 30, 2015, 7:38:03 AM8/30/15
to django-...@googlegroups.com
#25326: Add an example with namedtuple to "Executing custom SQL directly"
-------------------------------+------------------------------------
Reporter: dodobas | Owner: nobody
Type: New feature | Status: new
Component: Documentation | Version: master

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

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

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/25326#comment:4>

Django

unread,
Sep 3, 2015, 1:12:56 PM9/3/15
to django-...@googlegroups.com
#25326: Add an example with namedtuple to "Executing custom SQL directly"
-------------------------------+------------------------------------
Reporter: dodobas | Owner: nobody
Type: New feature | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed

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

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

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


Comment:

In [changeset:"5ab65ca5c900557f508f62a260f9ea53d9d93f37" 5ab65ca5]:
{{{
#!CommitTicketReference repository=""
revision="5ab65ca5c900557f508f62a260f9ea53d9d93f37"
Fixed #25326 -- Added namedtuple example for executing custom SQL.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25326#comment:5>

Django

unread,
Sep 3, 2015, 1:18:00 PM9/3/15
to django-...@googlegroups.com
#25326: Add an example with namedtuple to "Executing custom SQL directly"
-------------------------------+------------------------------------
Reporter: dodobas | Owner: nobody
Type: New feature | Status: closed
Component: Documentation | Version: master

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

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

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

In [changeset:"5ed9616a09679f1b03fd4421c5adbfab17c74efc" 5ed9616]:
{{{
#!CommitTicketReference repository=""
revision="5ed9616a09679f1b03fd4421c5adbfab17c74efc"
[1.8.x] Fixed #25326 -- Added namedtuple example for executing custom SQL.

Backport of 5ab65ca5c900557f508f62a260f9ea53d9d93f37 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25326#comment:6>

Reply all
Reply to author
Forward
0 new messages