I have a function that I want to use when mass creating tables.
This is the function:
def make_tables(tablenames: list, cursor: sql.Cursor, parameters, connection: sql.Connection):
for i in tablenames:
cursor.execute(f"CREATE TABLE IF NOT EXISTS '{scrub(i)}' ('{parameters}')")
connection.commit()
My parameters variable is parameters = 'name text, id integer'
what it does, is create a table with one column, called 'name text, id integer' and type unknown.
The solutions from here: Python sqlite3, create table columns from a list with help of .format don't work.
I will have different names and types as input, and the number of columns will vary.
What ways are there to solving this problem?