> SQLAlchemy batches inserts in the ORM as is possible and with Core you > do this explicitly, both make use of cursor.executemany() which is then > determined by how the DBAPI handles it.
Ummm. If that is true, why this line is used when I pass a list of values (its from visit_insert)? Clearly sqlalchemy creates big string `VALUES (%s, %s), (%s, %s)....` by itself without executemany. elif insert_stmt._has_multi_parameters: text += " VALUES %s" % ( ", ".join( "(%s)" % ( ', '.join(c[1] for c in crud_param_set) ) for crud_param_set in crud_params ) ) I've written benchmark again. https://gist.github.com/purpleP/35c4920020ad95585419eb1d250200b7 TLDR; alchemy is more than three times slower than executemany for inserting 10000 values. for a million values sqlalchemy drops with OperationalError. Here's a vmprof visualization for 10000 values http://vmprof.com/#/c7f9a4fd-55f9-469d-b6e4-b7cac04473fa . vmprof is much better than cProfile give it a try if you still coding in python. If you will need more data then just a visualization - I'll try to provide it. But you have the benchmark code in the gist. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.