When trying to cache the contents of some "small" tables, I followed a
recipe given by Michael Bayer on this list (at least how I understood
it): create a "dead" session without database connection and move all
these objects into it.

However, every "outside" object that references one of these objects
pulls it into the current session. That's a problem because objects
are created in a multithreaded environment with concurrent and
relatively short-lived sessions. (That's the reason for the caching in
the first place; otherwise the session alone could handle it).

So I tried to copy an object on access from the cache and enter it
into the session that requested it. (I had to fiddle with
_instance_key and _sa_session_id because a plain session.update()
wouldn't accept the copy.) session.query.get is overridden in a
MapperExtension, so that references from objects in the current
session also get copies of cached objects.

But despite all these precautions, original objects from the cache
with their original (i.e. wrong) session ids end up in the current
session all the time. How can they leak in? The current session is not
even supposed to see these original objects in the cache.

Is there a hidden connection between different sessions? I hope you
can make sense of these vague description.

Best regards
  Klaus


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to