summaryrefslogtreecommitdiff
path: root/examples/performance
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-03-11 20:17:08 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2015-03-11 20:17:08 -0400
commit944fa00211db55c051dffc14bbf94169b8919a75 (patch)
treea8d7a733bfd04c72d2b24f6548040f0fceae6373 /examples/performance
parent5ccda3f2d95d7fbf7713df7e4eab61059a6683cd (diff)
downloadsqlalchemy-ticket_3054.tar.gz
- API cleanupticket_3054
- docs - lets go
Diffstat (limited to 'examples/performance')
-rw-r--r--examples/performance/__init__.py2
-rw-r--r--examples/performance/short_selects.py6
2 files changed, 5 insertions, 3 deletions
diff --git a/examples/performance/__init__.py b/examples/performance/__init__.py
index 88ae9b7dc..6264ae9f7 100644
--- a/examples/performance/__init__.py
+++ b/examples/performance/__init__.py
@@ -6,7 +6,7 @@ profile and associated implications:
* bulk inserts
* individual inserts, with or without transactions
* fetching large numbers of rows
-* running lots of small queries (TODO)
+* running lots of short queries
All suites include a variety of use patterns illustrating both Core
and ORM use, and are generally sorted in order of performance from worst
diff --git a/examples/performance/short_selects.py b/examples/performance/short_selects.py
index 27120fe6a..ef1fcff4a 100644
--- a/examples/performance/short_selects.py
+++ b/examples/performance/short_selects.py
@@ -73,9 +73,10 @@ def test_orm_query_cols_only(n):
@Profiler.profile
def test_baked_query(n):
"""test a baked query of the full entity."""
+ bakery = baked.bakery()
s = Session(bind=engine)
for id_ in random.sample(ids, n):
- q = baked.BakedQuery(lambda s: s.query(Customer))
+ q = bakery(lambda s: s.query(Customer))
q += lambda q: q.filter(Customer.id == bindparam('id'))
q(s).params(id=id_).one()
@@ -83,9 +84,10 @@ def test_baked_query(n):
@Profiler.profile
def test_baked_query_cols_only(n):
"""test a baked query of only the entity columns."""
+ bakery = baked.bakery()
s = Session(bind=engine)
for id_ in random.sample(ids, n):
- q = baked.BakedQuery(
+ q = bakery(
lambda s: s.query(
Customer.id, Customer.name, Customer.description))
q += lambda q: q.filter(Customer.id == bindparam('id'))