summaryrefslogtreecommitdiff
path: root/examples/performance
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2020-09-02 23:46:06 +0200
committerMike Bayer <mike_mp@zzzcomputing.com>2020-09-08 17:13:48 -0400
commite8600608669d90c4a6385b312d271aed63eb5854 (patch)
treeef984a01c536b2c81d2283b3ca5d9f4395f41dd0 /examples/performance
parent0d56a62f721ee6c91d8a8b6a407b959c9215b3b6 (diff)
downloadsqlalchemy-e8600608669d90c4a6385b312d271aed63eb5854.tar.gz
Update select usage to use the new 1.4 format
This change includes mainly that the bracketed use within select() is moved to positional, and keyword arguments are removed from calls to the select() function. it does not yet fully address other issues such as keyword arguments passed to the table.select(). Additionally, allows False / None to both be considered as "disable" for all of select.correlate(), select.correlate_except(), query.correlate(), which establishes consistency with passing of ``False`` for the legact select(correlate=False) argument. Change-Id: Ie6c6e6abfbd3d75d4c8de504c0cf0159e6999108
Diffstat (limited to 'examples/performance')
-rw-r--r--examples/performance/short_selects.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/performance/short_selects.py b/examples/performance/short_selects.py
index ff9156360..4e5c3eb00 100644
--- a/examples/performance/short_selects.py
+++ b/examples/performance/short_selects.py
@@ -159,7 +159,7 @@ def test_core_new_stmt_each_time(n):
with engine.connect() as conn:
for id_ in random.sample(ids, n):
- stmt = select([Customer.__table__]).where(Customer.id == id_)
+ stmt = select(Customer.__table__).where(Customer.id == id_)
row = conn.execute(stmt).first()
tuple(row)
@@ -173,7 +173,7 @@ def test_core_new_stmt_each_time_compiled_cache(n):
compiled_cache=compiled_cache
) as conn:
for id_ in random.sample(ids, n):
- stmt = select([Customer.__table__]).where(Customer.id == id_)
+ stmt = select(Customer.__table__).where(Customer.id == id_)
row = conn.execute(stmt).first()
tuple(row)
@@ -182,7 +182,7 @@ def test_core_new_stmt_each_time_compiled_cache(n):
def test_core_reuse_stmt(n):
"""test core, reusing the same statement (but recompiling each time)."""
- stmt = select([Customer.__table__]).where(Customer.id == bindparam("id"))
+ stmt = select(Customer.__table__).where(Customer.id == bindparam("id"))
with engine.connect() as conn:
for id_ in random.sample(ids, n):
@@ -194,7 +194,7 @@ def test_core_reuse_stmt(n):
def test_core_reuse_stmt_compiled_cache(n):
"""test core, reusing the same statement + compiled cache."""
- stmt = select([Customer.__table__]).where(Customer.id == bindparam("id"))
+ stmt = select(Customer.__table__).where(Customer.id == bindparam("id"))
compiled_cache = {}
with engine.connect().execution_options(
compiled_cache=compiled_cache