Skip to content

Add support for executemany()#810

Open
bgunebakan wants to merge 1 commit into
mainfrom
fix/807-executemany-does-not-translate-pyformat-dict-params
Open

Add support for executemany()#810
bgunebakan wants to merge 1 commit into
mainfrom
fix/807-executemany-does-not-translate-pyformat-dict-params

Conversation

@bgunebakan
Copy link
Copy Markdown
Contributor

Summary of the changes / Why this is an improvement

Checklist

@bgunebakan bgunebakan added the bug label Jun 8, 2026
@bgunebakan bgunebakan linked an issue Jun 8, 2026 that may be closed by this pull request
@bgunebakan bgunebakan force-pushed the fix/807-executemany-does-not-translate-pyformat-dict-params branch from e6aed17 to 91299e4 Compare June 8, 2026 12:21
@bgunebakan bgunebakan requested review from kneth and mfussenegger June 8, 2026 12:24
Copy link
Copy Markdown
Member

@kneth kneth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +155 to +156
and isinstance(bulk_parameters[0], dict)
and _NAMED_PARAM_RE.search(sql)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if there is a mix of dict/non-dict args?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently we raise an error. Do we have case to use mix of dict/non-dict together? I couldn't find how server handle that. What it should do?

):
cursor = mocked_connection.cursor()
cursor.executemany(
"INSERT INTO characters (name, age) VALUES (%(name)s, %(age)s)",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a case where one named argument is used multiple times and check that it gets the same position number?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

executemany() does not translate pyformat dict params

3 participants