Currently I have the following code which checks if tablename "Company" exists in the database, and then creates the table with the given fields.
cur.executescript('''
DROP TABLE IF EXISTS Company;
CREATE TABLE Company (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
name VARCHAR2
)
''')
I want to make this query generic as in, instead of just using "Company" in my query, I need to take the names from a list. Is it possible to pass a variable in the query instead of passing "Company" in this example.
Thank you!
cur.executescript('''... IF EXISTS %s; CREATE ...''' % my_variable)?