summaryrefslogtreecommitdiff
path: root/examples/sharding/attribute_shard.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-11-28 12:00:01 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2010-11-28 12:00:01 -0500
commit61840abbce0066bad3b974ed98999a5f6ff267ca (patch)
tree588ea803e12f25ea16b6bdf39b8ada272525669d /examples/sharding/attribute_shard.py
parent134d78c8b44c40102afb030e6284a9d1e6acb65a (diff)
downloadsqlalchemy-61840abbce0066bad3b974ed98999a5f6ff267ca.tar.gz
- NullPool is now used by default for SQLite file-
based databases. :memory: databases will continue to select SingletonThreadPool by default. [ticket:1921]
Diffstat (limited to 'examples/sharding/attribute_shard.py')
-rw-r--r--examples/sharding/attribute_shard.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/sharding/attribute_shard.py b/examples/sharding/attribute_shard.py
index fd1fa50ae..6b4813dd3 100644
--- a/examples/sharding/attribute_shard.py
+++ b/examples/sharding/attribute_shard.py
@@ -8,9 +8,12 @@ from sqlalchemy.sql import operators, visitors
import datetime
-# step 2. databases
+# step 2. databases.
+# db1 is used for id generation. The "pool_threadlocal"
+# causes the id_generator() to use the same connection as that
+# of an ongoing transaction within db1.
echo = True
-db1 = create_engine('sqlite://', echo=echo)
+db1 = create_engine('sqlite://', echo=echo, pool_threadlocal=True)
db2 = create_engine('sqlite://', echo=echo)
db3 = create_engine('sqlite://', echo=echo)
db4 = create_engine('sqlite://', echo=echo)