这是我剧本的一部分:
sql1 = """
SELECT distinct th.name, 'MMS' as Status
FROM t1
JOIN t2 on t1.id = t2.tid
WHERE t2.station= 'MatS'
AND t1.name IN ({listthinglist})
""".format(listthinglist=', '.join("'" + item + "'" for item in list_of_things))
cur.execute(sql1)
list_of_things
包含22016项,我无法用python运行此查询。在python中有没有其他方法可以运行这样的查询。你知道吗
请不要对此使用
format
。execute
函数接受一个“parameters”参数,您可以将列表传递给它。您可以这样修改它:相关问题 更多 >
编程相关推荐