]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
tweak
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 4 Sep 2014 00:30:52 +0000 (20:30 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 4 Sep 2014 00:30:52 +0000 (20:30 -0400)
examples/performance/bulk_inserts.py
examples/performance/large_resultsets.py

index 648d5f2aad6df44ebad1642abf865129ccd7abd4..531003aa66466ca01e387024b5b47a31a04c0091 100644 (file)
@@ -1,3 +1,8 @@
+"""This series of tests illustrates different ways to INSERT a large number
+of rows in bulk.
+
+
+"""
 from . import Profiler
 
 from sqlalchemy.ext.declarative import declarative_base
@@ -69,7 +74,7 @@ def test_flush_pk_given(n):
 
 @Profiler.profile
 def test_bulk_save(n):
-    """Batched INSERT statements via the ORM in "bulk", discarding PK values."""
+    """Batched INSERT statements via the ORM in "bulk", discarding PKs."""
     session = Session(bind=engine)
     session.bulk_save_objects([
         Customer(
@@ -83,7 +88,7 @@ def test_bulk_save(n):
 
 @Profiler.profile
 def test_bulk_insert_mappings(n):
-    """Batched INSERT statements via the ORM "bulk", using dictionaries instead of objects"""
+    """Batched INSERT statements via the ORM "bulk", using dictionaries."""
     session = Session(bind=engine)
     session.bulk_insert_mappings(Customer, [
         dict(
@@ -112,7 +117,7 @@ def test_core_insert(n):
 
 @Profiler.profile
 def test_dbapi_raw(n):
-    """The DBAPI's pure C API inserting rows in bulk, no pure Python at all"""
+    """The DBAPI's API inserting rows in bulk."""
 
     conn = engine.pool._creator()
     cursor = conn.cursor()
index c9ce23d61be2c162ae8d31149b993f79e8928a07..77c0246fc4a00aa6333394472be9ac5abe0b437e 100644 (file)
@@ -121,7 +121,7 @@ def test_core_fetchmany(n):
 
 @Profiler.profile
 def test_dbapi_fetchall_plus_append_objects(n):
-    """Load rows using DBAPI fetchall(), make a list of objects."""
+    """Load rows using DBAPI fetchall(), generate an object for each row."""
 
     _test_dbapi_raw(n, True)
 
@@ -156,12 +156,10 @@ def _test_dbapi_raw(n, make_objects):
     cursor.execute(sql)
 
     if make_objects:
-        result = []
         for row in cursor.fetchall():
             # ensure that we fully fetch!
             customer = SimpleCustomer(
                 id=row[0], name=row[1], description=row[2])
-            result.append(customer)
     else:
         for row in cursor.fetchall():
             # ensure that we fully fetch!