aio-libs / aiomysql

aiomysql is a library for accessing a MySQL database from the asyncio
https://aiomysql.rtfd.io
MIT License
1.75k stars 255 forks source link

Compiled cache not working with SA executemany #375

Open katajakasa opened 5 years ago

katajakasa commented 5 years ago

I've been poking at the sqlalchemy connections compiled cache. It seems to work just fine for normal queries, but anything that goes through executemany does not seem to get cached. My test case is bulk insert, which seems to be suspiciously slower than when using multiple cached single queries. After taking a look at aiomysql's saconnection, the executemany does not actually even implement the cache.

So, is this omission intentional or just a forgotten feature ? I can't think of a case where the caching would not work, but on the other hand, I'm a noob when it comes to *sql drivers :)

aio-libs-bot commented 5 years ago

GitMate.io thinks possibly related issues are https://github.com/aio-libs/aiomysql/issues/290 (Cannot make db -> python value conversion working with custom SA columns), https://github.com/aio-libs/aiomysql/issues/49 (create_pool can not work with async/await feature), https://github.com/aio-libs/aiomysql/issues/46 ('trans.rollback()' is not working correct), https://github.com/aio-libs/aiomysql/issues/158 (aiomysql enabled cache?), and https://github.com/aio-libs/aiomysql/issues/86 (Inconsistant results after insert using sa).

katajakasa commented 5 years ago

I had some free time, so I wrote a fix which seems to be working: #376