Re: eagerly fetching joined objects

Simon Cross <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <CAD5NRCEbF8m+JoE14DmV2RV37iv=by5D1TgiC6_BGe6JWF8bew@mail.gmail.com>
Hi

On Thu, Jul 21, 2011 at 2:07 AM, Simon Laalo
<[email protected]> wrote:
> I'm currently trying to improve my DB performance by reducing the number of queries
> and associated overhead while grabbing some SQLObjects from the DB.  I would like
> to have SQLObject fully populate the object graph for the objects I'm using since all
> joined objects will be read every time this object is loaded.

I encountered a similar need in one of my own projects and wrote a
caching version of RelatedJoin that you could probably take ideas from
for a caching version of MultipleJoin / ForeignKey.  You can find the
code at http://sutekh.svn.sourceforge.net/viewvc/sutekh/trunk/sutekh/sutekh/core/CachedRelatedJoin.py?revision=2873&view=markup.
I considered contributing it back to SQLObject but it's a bit finicky
to use -- one has to manually initialize the cache (see init_cache
method) and then flush the cache (flush_cache) or just particular
items (invalidate_cache_item) from within one's application as needed.

Schiavo
Simon

------------------------------------------------------------------------------
5 Ways to Improve & Secure Unified Communications
Unified Communications promises greater efficiencies for business. UC can 
improve internal communications as well as offer faster, more efficient ways
to interact with customers and streamline customer service. Learn more!
http://www.accelacomm.com/jaw/sfnl/114/51426253/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.