]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
repair large_resultsets
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 22 Apr 2023 21:18:16 +0000 (17:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 22 Apr 2023 21:18:16 +0000 (17:18 -0400)
this is ahead of https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/4581/

Change-Id: If8a36e457bdb62ddca04e39bb4c1288d4fa53c20

examples/performance/large_resultsets.py

index ac1b98b6f5aafac2fd5162c46c32a525b12a94d8..9c0d9fc4e2155cc976a55c50d6bb5671e6c0985d 100644 (file)
@@ -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