#31843: PicklingError: Can't pickle <class 'django.db.models.query.Row'>: 
attribute
lookup Row on django.db.models.query failed
-------------------------------------+-------------------------------------
               Reporter:  Vitaliy    |          Owner:  nobody
  Yelnik                             |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  3.0
  layer (models, ORM)                |       Keywords:  pickle namedtuple
               Severity:  Normal     |  values_list
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 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>
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/048.ed8b5c89e039557c7f5c3a0b51d7418f%40djangoproject.com.

Reply via email to