出于性能原因,我使用此 SQL:
sql_tmpl = """delete from Data where id_data in (:iddata) """
params = {
'iddata':[1, 2,3 4],
}
# 'session' is a session object from SQLAlchemy
self.session.execute(text(sql_tmpl), params)
但是,我遇到了一个例外:
NotSupportedError: (NotSupportedError) ('Python type list not supported. param=1', 'HY097')
是否有一种解决方法可以让我将列表绑定到“in”子句的参数?