放大MySQL“ where in”子句的python列表

时间:2018-08-26 06:48:52

标签: mysql python-3.x

我已经在imploding a list for use in a python MySQLDB IN clause

上查看了建议

我正在尝试做同样的事情-获取一个列表并将其注入MySQL查询的“ where in”子句中。

我遇到的问题是,我需要像下面的语句一样先注入其他值:

 self.cur.execute(
"update table set status = 0, last_update = %s where tenant = %s and status = 1 and name in (%s)" %
    (datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), self.config['application_settings']['tenant']), format_strings, tuple(names_to_delete)
        )

我不断收到错误消息:格式字符串的参数不足

有什么提示吗?

0 个答案:

没有答案