我有以下查询:
import jaydebeapi,pandas as pd
cursor = conn.cursor()
cursor.execute('''INSERT INTO MD SELECT DISTINCT MD FROM viewshareddim.TMD_VIP
WHERE STN_ID=? AND P_T in ? AND ID in ? AND C_ID = ?''', (MD[0],MD[1],MD[2],MD[3]))
值是:
MD = [01,(02,05,06),(02,04,05),8]
试图参考此处python list提供的解决方案,但没有获得如何为查询实现该解决方案的方法。如果可以提供任何指导,将不胜感激。
尝试过:
INSERT INTO MD SELECT DISTINCT MD FROM viewshareddim.TMD_VIP
WHERE STN_ID=(?) AND P_T in (?) AND ID in (?) AND C_ID = (?), (MD[0],MD[1],MD[2],MD[3])
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/jaydebeapi/__init__.py", line 499, in execute
self._set_stmt_parms(self._prep, parameters)
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/jaydebeapi/__init__.py", line 490, in _set_stmt_parms
prep_stmt.setObject(i + 1, parameters[i])
RuntimeError: No matching overloads found for setObject in find. at
native/common/jp_method.cpp:127
答案 0 :(得分:-1)
我尝试评估列表,以便将其传递给数据库时,它只是由数据库执行的字符串