Skip to content

Batch execution of insert SQL using the aiomysql.execemany method #516

Open
@Zhao-Panpan

Description

@Zhao-Panpan

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:

        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:

        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)
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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpymysqlpymysql-portAwaiting or implementing port of PyMySQL change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions