Removal (rename) of BaseQuery in SVN version causes ImportError for previously pickled Querysets
The issue seems to be that pickling a Queryset's query attribute per the documentation pickles a BaseQuery object. With Query taking the place of BaseQuery in the current svn version an attempt to unpickle a pickled BaseQuery object results in an import error. I don't have a particularly deep understanding of how cPickle and pickle work but my guess is that pickle attempts to instantiate a new object based on the pickled object's __module__
and __class__
values. If there isn't a simple fix for this it seems the documentation should at least be ammended to warn of the issue.
Change History
(6)
Component: |
Uncategorized → Database layer (models, ORM)
|
Component: |
Database layer (models, ORM) → Documentation
|
milestone: |
→ 1.2
|
Triage Stage: |
Unreviewed → Accepted
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
There's almost no way that we could protect against this sort of problem. Any change to the internals of a class like Query - which *will* happen between Django versions - will inevitably lead to unpickling problems, as the old class won't be compatible with the new class. Even if we hadn't renamed BaseQuery->Query, this would have still been a problem due to the massive internal refactoring of the Query class itself.
A documentation note to the effect of "pickles won't survive a version update" on the queryset pickling docs is about the best we can do here.