0
SQL query with table as variable
I'm building an application with python, to access a database. The database contains 3 tables. Now I want to create an sql-query like: listColums = [id, name , tel...] listUpdateInfo = [updateID1, updateName1, ...] if tableName == "table": "UPDATE tableName SET listColums[x] = listUpdateInfo[0] WHERE listColums[y] = listUpdateInfo[y]" Is that possible? Yes/No is ok for me :)
1 Answer
0
Got it. Create a SQL-statement like
sql = "UPDATE " + tableName + "SET" + ...."
cursor.execute(sql)
maybe helpful to someone :)