Fix executemany batch insert operations sentinel RE #81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
MySQLCursor.executemany()
method implements a sentinel for detecting batch insert operations and grouping multipleINSERT
queries into a significantly more performant singleINSERT
query with multiple values.The current definition of the RE is faulty, causing the sentinel to fail in correctly identifying batch
INSERT
operations. This fault seems to be due to a regression introduced in ddf6b13, released as part of v8.0.30.As can be seen in diff#ddf6b13, while the
.format()
invocation was removed from cursor.py#L52, the escaping curly braces for the RE quantifier defined were left behind. Lacking the.format()
invocation the previously escaping curly braces to the RE quantifier now defined at lib/mysql/connector/cursor.py#L59 have become part of the RE itself, thus breaking the sentinel to always fail identifying batchINSERT
operations.This PR fixes the above described regression. The associated MySQL issue tracker bug: https://bugs.mysql.com/bug.php?id=108145&thanks=2¬ify=195