aio-libs / aio-libs/aiomysql

Batch execution of insert SQL using the aiomysql.execemany method

Đang mở
#516 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug pymysql pymysql-port
Ngôn ngữ chính
Python
Star
1.9k
Fork
272
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.