Sorry I can't post a benchmark here, because I'm not in the office. Maybe I will do that tomorrow. I use vmprof and can just share a link to the uploaded profile. Will that suite you?
But I can say right now that I've passed only integers, not strings. Also mysqlclient encoding values if needed as far as I can see. https://github.com/PyMySQL/mysqlclient-python/blob/master/MySQLdb/cursors.py see _do_execute_many at line 286. And the fact that sqlalchemy doesn't make batches automatically is much worse than performance problems. Heuristics will not work one day, which means any inserts to the database should be surrounded with try catch etc. sqlalchemy makes sql by ', '.join on values, which makes it impossible for it to see that the string size is to big until it's too late. I think it's better to use approach that mysqlclient is using, where they encode prefix and postfix query part into bytearray (which is mutable) and append arguments to it checking that the bytearray size is less then the limit. -- 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.