Ńņ ‰„[Jc@sdZddkiZddklZddklZddkl Z ddgZ defd„ƒYZ de fd „ƒYZ dS( s$Horizontal sharding support. Defines a rudimental 'horizontal sharding' system which allows a Session to distribute queries and persistence operations across multiple databases. For a usage example, see the file ``examples/sharding/attribute_shard.py`` included in the source distrbution. i’’’’N(tutil(tSession(tQuerytShardedSessiont ShardedQuerycBsAeZdd„Zdddd„Zdddd„Zd„ZRS(cKstt|ƒi|||_||_||_h|_h|id6|_t |_ |dj o)x&|D]}|i |||ƒqjWndS(s˜Construct a ShardedSession. shard_chooser A callable which, passed a Mapper, a mapped instance, and possibly a SQL clause, returns a shard ID. This id may be based off of the attributes present within the object, or on some round-robin scheme. If the scheme is based on a selection, it should set whatever state on the instance to mark it in the future as participating in that shard. id_chooser A callable, passed a query and a tuple of identity values, which should return a list of shard ids where the ID might reside. The databases will be queried in the order of this listing. query_chooser For a given Query, returns the list of shard_ids where the query should be issued. Results from all shards returned will be combined together into a single listing. tconnection_callableN( tsuperRt__init__t shard_choosert id_choosert query_choosert_ShardedSession__bindst connectiont_mapper_flush_optsRt _query_clstNonet bind_shard(tselfRR R tshardstkwargstk((s8/usr/lib/python2.6/site-packages/sqlalchemy/orm/shard.pyRs      cKsp|djo|i||ƒ}n|idj o|ii|d|ƒS|i|d|d|ƒi|SdS(Ntshard_idtinstance(RRt transactionR tget_bindtcontextual_connect(RtmapperRRR((s8/usr/lib/python2.6/site-packages/sqlalchemy/orm/shard.pyR ;s  cKs4|djo|i||d|ƒ}n|i|S(Ntclause(RRR (RRRRRtkw((s8/usr/lib/python2.6/site-packages/sqlalchemy/orm/shard.pyRDs cCs||i|s 3