#31843: django.db.models.query.Row is not pickleable.
-------------------------------------+-------------------------------------
Reporter: Vitaliy Yelnik | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 3.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: pickle namedtuple | Triage Stage: Accepted
values_list |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):
* stage: Unreviewed => Accepted
Old description:
> The new named parameter of QuerySet.values_list() was released In Django
> 2.0 (#15648).
> But resulted namedtuple-s can't be pickled:
> {{{
> class ModelA(models.Model):
> value = models.CharField(max_length=12)
> }}}
>
> {{{
> In [12]: row = ModelA.objects.values_list('id', 'value',
> named=True).first()
>
> In [14]: type(row)
> Out[14]: django.db.models.query.Row
>
> In [16]: pickle.dumps(row)
> PicklingError: Can't pickle <class 'django.db.models.query.Row'>:
> attribute lookup Row on django.db.models.query failed
> }}}
>
> In particular, as a result, such requests do not work with cacheops
> package.
New description:
The new named parameter of QuerySet.values_list() was released In Django
2.0 (#15648).
But resulted namedtuple-s can't be pickled:
{{{
class ModelA(models.Model):
value = models.CharField(max_length=12)
}}}
{{{
In [12]: row = ModelA.objects.values_list('id', 'value',
named=True).first()
In [14]: type(row)
Out[14]: django.db.models.query.Row
In [16]: pickle.dumps(row)
PicklingError: Can't pickle <class 'django.db.models.query.Row'>:
attribute lookup Row on django.db.models.query failed
}}}
In particular, as a result, such requests do not work with cacheops
package.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/31843#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.45458023ecf836de5263d34379107224%40djangoproject.com.