我正在尝试在 python 中执行以下代码,但它会syntax error near '('
导致executemany(..)
. 当我从中删除名字sql
并只写%s
它时,也会导致错误,there are more placeholders thant the variables
有人知道我该如何解决吗?
upInfo ={"aa": "aaa","bb": "bbb","cc": "ccc"}
sql = 'UPDATE table SET a= %(aa)s WHERE b= %(bb)s and c= %(cc)s'
con = pymssql.connect(...)
con.autocommit(True)
cur = con.cursor()
cur.executemany(sql, upInfo)