Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73523

Re: Python ORM library for distributed mostly-read-only objects?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'concurrently': 0.07; 'explicit': 0.07; 'result,': 0.07; 'session.': 0.07; 'extends': 0.09; 'objects,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'stale': 0.09; 'thread': 0.14; '23,': 0.16; 'aggressively': 0.16; 'caches': 0.16; 'concurrent': 0.16; 'iirc': 0.16; 'in-memory': 0.16; 'lie': 0.16; 'locally,': 0.16; 'operation.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'sqlalchemy': 0.16; 'subject:ORM': 0.16; 'subject:library': 0.16; 'traverse': 0.16; 'underlying': 0.16; 'unexpected': 0.16; 'url:guide': 0.16; 'url:html)': 0.16; 'wrote:': 0.18; '(not': 0.18; 'header:User- Agent:1': 0.23; 'instead.': 0.24; 'sends': 0.24; 'connected': 0.24; 'supported': 0.26; 'header:X-Complaints-To:1': 0.27; 'header :In-Reply-To:1': 0.27; 'database,': 0.30; 'network.': 0.30; 'loading': 0.31; 'monday,': 0.33; 'problem': 0.35; 'objects': 0.35; 'instances': 0.36; 'object,': 0.36; 'ryan': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'server': 0.38; 'to:addr :python-list': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; "you're": 0.61; 'email addr:gmail.com': 0.63; 'provide': 0.64; 'more': 0.64; 'charset:windows-1252': 0.65; 'reads': 0.68; 'therefore': 0.72; 'personally.': 0.84; 'safe.': 0.84; 'subject:read': 0.84; 'received:31': 0.91; 'url:latest': 0.91; 'suited': 0.93; 'tied': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Lie Ryan <lie.1296@gmail.com>
Subject Re: Python ORM library for distributed mostly-read-only objects?
Date Tue, 24 Jun 2014 00:16:36 +0100
References <85659fdd-511b-4aea-9c4b-17a4bbb88662@googlegroups.com> <mailman.11203.1403538899.18130.python-list@python.org> <9030a8c2-2a11-4ea8-a9f0-c23d31e0d925@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 31.55.90.126
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0
In-Reply-To <9030a8c2-2a11-4ea8-a9f0-c23d31e0d925@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.11206.1403565412.18130.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1403565412 news.xs4all.nl 2930 [2001:888:2000:d::a6]:44461
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73523

Show key headers only | View raw


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 | NextPrevious in thread | Find similar | Unroll thread


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