aio-libs / aio-libs/aiomysql

Batch execution of insert SQL using the aiomysql.execemany method

未關閉
#516 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug pymysql pymysql-port
主要語言
Python
星號
1.9k
分支
272
PR 合併指標
30 天內沒有已合併 PR

描述

When I use the aiomysql.execemany method to batch execute insert SQL, I find that the internal mechanism is for loop to execute all statements, comparison Pymysql.cursors File, found that the regular expression is different.
The comparison is as follows:
aiomysql.cursors File:
```py3
RE_INSERT_VALUES = re.compile(
r"\s*((?:INSERT|REPLACE)\s.+\sVALUES?\s+)" +
r"(\(\s*(?:%s|%\(.+\)s)\s*(?:,\s*(?:%s|%\(.+\)s)\s*)*\))" +
r"(\s*(?:ON DUPLICATE.*)?);?\s*\Z",
re.IGNORECASE | re.DOTALL)
```
pymysql.cursors File:
```py3
RE_INSERT_VALUES = re.compile(
r"\s*((?:INSERT|REPLACE)\b.+\bVALUES?\s*)" +
r"(\(\s*(?:%s|%\(.+\)s)\s*(?:,\s*(?:%s|%\(.+\)s)\s*)*\))" +
r"(\s*(?:ON DUPLICATE.*)?);?\s*\Z",
re.IGNORECASE | re.DOTALL)
```

```py3
my_data_sql = "insert abc(name) values(%s)"
```

I find `insert abc(name) values (%s)` no such problem,but when there is no space between `values` and `(`,have this problem.

I hope it can help me solve my doubts.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。