From: Mike Bayer Date: Sat, 22 Apr 2023 21:18:16 +0000 (-0400) Subject: repair large_resultsets X-Git-Tag: rel_2_0_11~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bfeb1b14b9a6560be15093c93a5e084e8735b62;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git repair large_resultsets this is ahead of https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/4581/ Change-Id: If8a36e457bdb62ddca04e39bb4c1288d4fa53c20 --- 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