在 sql.executemany(... '(' 附近的语法错误

In sql.executemany(... syntax error near '('

我试图在 python 中执行以下代码,但它导致 executemany(..) 出现 syntax error near '(' 错误。当我从 sql 中删除 te names 并只写 %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)

因为这是executemany(),所以应该是字典列表:

upInfo = [{"aa": "aaa", "bb": "bbb", "cc": "ccc"}]

或者,使用常规 execute():

cur.execute(sql, upInfo)