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 :)

28th Dec 2020, 11:15 AM
Fu Foy
Fu Foy - avatar
1 Réponse
0
Got it. Create a SQL-statement like sql = "UPDATE " + tableName + "SET" + ...." cursor.execute(sql) maybe helpful to someone :)
28th Dec 2020, 1:48 PM
Fu Foy
Fu Foy - avatar