On 05/25/2017 12:02 PM, Михаил Доронин wrote:
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?
I would much prefer if you can send a traditional cProfile file as I
don't have the time to learn how to use vmprof.
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.
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.
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 don't know what "the string size is too big" refers to, but also this
sounds like a topic other than performance. if the ",".join() refers
to how an INSERT is composed, that has nothing to do with the data
you're passing in the insert, it is just building bound parameter
placeholders.
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.
Sorry, I'm not familiar with what this is referring towards.
--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.