模块化SQL WHERE语句

时间:2018-06-14 12:54:49

标签: python sql where modularity

我试图在具有模块化输入的python脚本中创建准备好的SQL语句。我有" INSERT"该语句的一部分工作但无法使模块化更新WHERE子句。有没有办法做到这一点?

query = "INSERT INTO MachineInfo ( Description, Location, IP, License )
         WHERE id = ID
         VALUES (?,?,?,?,?)"


#The arguments are all predefined variables
args = [ deviceName, deviceLocation, ipAddress, license, ID ]

system.db.runPrepUpdate( query, args )

1 个答案:

答案 0 :(得分:1)

您似乎想要UPDATE

UPDATE MachineInfo 
    SET Description = ?,
        Location = ?,
        IP = ?,
        License = ?
    WHERE id = ?;