Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73523
| From | Lie Ryan <lie.1296@gmail.com> |
|---|---|
| Subject | Re: Python ORM library for distributed mostly-read-only objects? |
| Date | 2014-06-24 00:16 +0100 |
| References | <85659fdd-511b-4aea-9c4b-17a4bbb88662@googlegroups.com> <mailman.11203.1403538899.18130.python-list@python.org> <9030a8c2-2a11-4ea8-a9f0-c23d31e0d925@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11206.1403565412.18130.python-list@python.org> (permalink) |
On 23/06/14 19:05, smurfix@gmail.com wrote: > On Monday, June 23, 2014 5:54:38 PM UTC+2, Lie Ryan wrote: > >> If you don't want each thread to have their own copy of the object, >> >> Don't use thread-scoped session. Use explicit scope instead. > > How would that work when multiple threads traverse the in-memory object structure and cause relationships to be loaded? > IIRC sqlalchemy's sessions are not thread safe. You're going to have that problem anyway, if it is as you said that your problem is that you don't want each thread to have their own copy, then you cannot avoid having to deal with concurrent access. Note that SQLAlchemy objects can be used from multiple thread as long as it's not used concurrently and the underlying DBAPI is thread-safe (not all DBAPI supported by SQLAlchemy are thread safe). You can detach/expunge an SQLAlchemy object from the session to avoid unexpected loading of relationships. Alternatively, if you are not tied to SQLAlchemy nor SQL-based database, then you might want to check out ZODB's ZEO (http://www.zodb.org/en/latest/documentation/guide/zeo.html): > ZEO, Zope Enterprise Objects, extends the ZODB machinery to > provide access to objects over a network. ... ClientStorage > aggressively caches objects locally, so in order to avoid > using stale data the ZEO server sends an invalidation message > to all the connected ClientStorage instances on every write > operation. ... As a result, reads from the database are > far more frequent than writes, and ZEO is therefore better > suited for read-intensive applications. Warning: I had never used ZODB nor ZEO personally.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Python ORM library for distributed mostly-read-only objects? smurfix@gmail.com - 2014-06-22 02:46 -0700
Re: Python ORM library for distributed mostly-read-only objects? Roy Smith <roy@panix.com> - 2014-06-22 09:49 -0400
Re: Python ORM library for distributed mostly-read-only objects? smurfix@gmail.com - 2014-06-22 21:26 -0700
Re: Python ORM library for distributed mostly-read-only objects? William Ray Wing <wrw@mac.com> - 2014-06-23 09:43 -0400
Re: Python ORM library for distributed mostly-read-only objects? Roy Smith <roy@panix.com> - 2014-06-23 11:11 -0400
Re: Python ORM library for distributed mostly-read-only objects? smurfix@gmail.com - 2014-06-23 11:00 -0700
Re: Python ORM library for distributed mostly-read-only objects? Matthias Urlichs <matthias@urlichs.de> - 2014-06-23 19:42 +0200
Re: Python ORM library for distributed mostly-read-only objects? Lie Ryan <lie.1296@gmail.com> - 2014-06-23 16:54 +0100
Re: Python ORM library for distributed mostly-read-only objects? smurfix@gmail.com - 2014-06-23 11:05 -0700
Re: Python ORM library for distributed mostly-read-only objects? Lie Ryan <lie.1296@gmail.com> - 2014-06-24 00:16 +0100
csiph-web