mysql connector/python executemany() is broken in conjunction with the default paramstyle
I'm assuming this is the current system of reporting bugs, as there appear to be no other links enabled for reporting bugs.
Test case is as follows - .paramstyle reports "pyformat" as the default parameter style, however this format is broken when using executemany().
This is against mysql-connector as returned by "bzr clone lp:myconnpy"
from mysql import connector
# from pep-249
# paramstyle
#
# String constant stating the type of parameter marker
# formatting expected by the interface. Possible values are
# ...
# 'pyformat' Python extended format codes,
# e.g. '...WHERE name=%(name)s'
assert connector.
conn = connector.
cursor = conn.cursor()
cursor.execute("""
create table if not exists test( x integer, y integer) engine='InnoDB'
""")
# 'format' style with executemany() - works
cursor.
[(1, 2), (3, 4)]
)
# 'pyformat' with execute() - works
cursor.
{"x": 1, "y": 2}
)
# 'pyformat' style with executemany() - broken
cursor.
[{"x":1, "y":2}, {"x":3, "y":4}]
)
"""
output:
Traceback (most recent call last):
File "mysqlconnector
[{"x":1, "y":2}, {"x":3, "y":4}]
File "/Library/
values.
ValueError: incomplete format
"""
- mike (<email address hidden>)
Question information
- Language:
- English Edit question
- Status:
- Expired
- Assignee:
- No assignee Edit question
- Last query:
- Last reply: