Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demo5.py #2

Open
zhu-jie opened this issue Dec 26, 2021 · 1 comment
Open

demo5.py #2

zhu-jie opened this issue Dec 26, 2021 · 1 comment

Comments

@zhu-jie
Copy link

zhu-jie commented Dec 26, 2021

原书例子

sql = 'INSERT INTO {table}({keys}) VALUES ({values}) ON DUPLICATE KEY UPDATE'.format(table=table, keys=keys, values=values)
update = ','.join(["{key} = %ss".format(key=key) for key in data])

执行无法插入报错,修改为

sql = 'INSERT INTO {table}({keys}) VALUES ({values}) ON DUPLICATE KEY UPDATE '.format(table=table, keys=keys, values=values)
update = ','.join(["{key} = %s".format(key=key) for key in data])
@Germey
Copy link
Member

Germey commented Dec 26, 2021

感谢反馈,的确是转义错误导致,我会尽快修正此勘误。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants