我想使用这个查询:
select x from y where z in ("a", "b", "c")
我有 pymysql 和 mysql.connector 用于 MySQL 和 Python。
这适用于 pymysql:
args = ["a", "b", "c"]
db = cur.execute('select x from y where z in %s',(tuple(args),))
但它不适用于 mysql.connector。它给了我像'MySQLConverter' object has no attribute '_tuple_to_mysql'这样的错误。
pymysql 有一个很好的解决方案,但我无法在 mysql.connector 上意识到这一点。你能帮我吗?