From 7bfeb1b14b9a6560be15093c93a5e084e8735b62 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 22 Apr 2023 17:18:16 -0400 Subject: [PATCH] repair large_resultsets this is ahead of https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/4581/ Change-Id: If8a36e457bdb62ddca04e39bb4c1288d4fa53c20 --- examples/performance/large_resultsets.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/examples/performance/large_resultsets.py b/examples/performance/large_resultsets.py index ac1b98b6f5..9c0d9fc4e2 100644 --- a/examples/performance/large_resultsets.py +++ b/examples/performance/large_resultsets.py @@ -107,6 +107,20 @@ def test_core_fetchall(n): with engine.connect() as conn: result = conn.execute(Customer.__table__.select().limit(n)).fetchall() + for row in result: + row.id, row.name, row.description + + +@Profiler.profile +def test_core_fetchall_mapping(n): + """Load Core result rows using fetchall.""" + + with engine.connect() as conn: + result = ( + conn.execute(Customer.__table__.select().limit(n)) + .mappings() + .fetchall() + ) for row in result: row["id"], row["name"], row["description"] @@ -124,7 +138,7 @@ def test_core_fetchmany_w_streaming(n): if not chunk: break for row in chunk: - row["id"], row["name"], row["description"] + row.id, row.name, row.description @Profiler.profile @@ -138,7 +152,7 @@ def test_core_fetchmany(n): if not chunk: break for row in chunk: - row["id"], row["name"], row["description"] + row.id, row.name, row.description @Profiler.profile -- 2.47.2