Reputation: 1243
say i want to create a table in sqlite3 with 3 columns,
tableparams = { "data" : "varchar" , "col2" : "char", "col3" : "integer" }
c = """create table mytesttable ( ? )"""
cur.executemany(c, tableparams )
I can't seem to get it done. The sql is supposed to be
create table myteststable ( data varchar, col2 char, col3 integer)
How can i "expand" out those params to be passed to executemany()? thanks
Upvotes: 1
Views: 104
Reputation: 180080
Only SQL values (numbers, strings, blobs) can be replaced by parameters.
Anything else must be written directly into the string:
cur.execute("create table myteststable ( data varchar, col2 char, col3 integer)")
Upvotes: 1