diff options
Diffstat (limited to 'examples/sharding/__init__.py')
| -rw-r--r-- | examples/sharding/__init__.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/examples/sharding/__init__.py b/examples/sharding/__init__.py index eb8e10686..90cf6cc6c 100644 --- a/examples/sharding/__init__.py +++ b/examples/sharding/__init__.py @@ -4,21 +4,28 @@ databases. The basic components of a "sharded" mapping are: -* multiple databases, each assigned a 'shard id' +* multiple :class:`_engine.Engine` instances, each assigned a "shard id". + These :class:`_engine.Engine` instances may refer to different databases, + or different schemas / accounts within the same database, or they can + even be differentiated only by options that will cause them to access + different schemas or tables when used. + * a function which can return a single shard id, given an instance to be saved; this is called "shard_chooser" + * a function which can return a list of shard ids which apply to a particular instance identifier; this is called "id_chooser".If it returns all shard ids, all shards will be searched. + * a function which can return a list of shard ids to try, given a particular Query ("query_chooser"). If it returns all shard ids, all shards will be queried and the results joined together. -In this example, four sqlite databases will store information about weather -data on a database-per-continent basis. We provide example shard_chooser, -id_chooser and query_chooser functions. The query_chooser illustrates -inspection of the SQL expression element in order to attempt to determine a -single shard being requested. +In these examples, different kinds of shards are used against the same basic +example which accommodates weather data on a per-continent basis. We provide +example shard_chooser, id_chooser and query_chooser functions. The +query_chooser illustrates inspection of the SQL expression element in order to +attempt to determine a single shard being requested. The construction of generic sharding routines is an ambitious approach to the issue of organizing instances among multiple databases. For a |
