File: __init__.py

package info (click to toggle)
sqlalchemy 0.6.3-3%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 10,744 kB
  • ctags: 15,132
  • sloc: python: 93,431; ansic: 787; makefile: 137; xml: 17
file content (20 lines) | stat: -rw-r--r-- 1,065 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""a basic example of using the SQLAlchemy Sharding API.
Sharding refers to horizontally scaling data across multiple
databases.

The basic components of a "sharded" mapping are:

* multiple databases, each assigned a 'shard id'
* 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.

"""