#31943: Queryset with values()/values_list() crashes when recreated from a pickled query. -------------------------------------+------------------------------------- Reporter: Beda Kosata | Owner: nobody Type: Bug | Status: new Component: Database layer | Version: 2.2 (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Beda Kosata): Replying to [comment:3 Simon Charette]: > Is there any reason you can't pickle the queryset object itself instead of `queryset.query`? > The reason is that I want to re-run the query, not get the stored result which is what happens when you pickle the whole queryset. > It feels like pickling of `QuerySet.query` and reassignment to an independently created `QuerySet` instance is asking for trouble. It's not a tested or documented pattern AFAIK. Please have a look at the link to documentation that is part of the original submission - https://docs.djangoproject.com/en/2.2/ref/models/querysets/#pickling- querysets. Pickling QuerySet.query **is** a documented pattern, otherwise I would not have been using it in the first place, as would not have occurred to me ;) -- Ticket URL: <https://code.djangoproject.com/ticket/31943#comment:4> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/064.1adc61cede4a8f8bf96e3aaa177fc612%40djangoproject.com.