There was a topic on this a couple of years ago, and it seems to still
be around.  (Original: 
http://groups.google.com/group/django-users/browse_thread/thread/32143d024b17dd00?pli=1)

An exception is raised when trying to use the low-level caching API on
a QuerySet.  I read from the mentioned thread that pickling the a
QuerySet after the refactor branch was merged has troubles, and as
Malcom has said, it's just straight-up "hard".

Especially from the documentation's explanation, I can see why it's no
easy task:

    "This means that when you unpickle a QuerySet, it contains the
results at the moment it was pickled, rather than the results that are
currently in the database."

Is there any hope of this being addressed in the near future?  I know
1.2 is feature-frozen, but what's the likelihood that this is going to
be fixed?  Can the documentation on Pickling QuerySets be updated to
actually reflect this issue?  The docs don't bring this up at all.
What's worse, is that pickling the QuerySets actually seems to work
just fine with the filesystem caching backend.  I can't begin to tell
you how long it took me to figure out the problem.

So... what's the difference between a pickled QuerySet in a filesystem
cache and a pickled QuerySet in a database cache?  It's the same
pickled string in the end.  I had a look at the area of code raising
the Exception, and I frankly don't understand what the backend has to
do with that line of code. (http://code.djangoproject.com/browser/
django/trunk/django/core/cache/backends/db.py line 57)

This creates annoying trouble for someone like me, trying to use a
database-driven caching system, yet specific parts of my site cannot
use my back-end of choice.

I've read the workaround of caching the list version of the results,
and I am looking into that.  I just want to find out a little more
about what the situation is, two years after that initial thread.

Tim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to