1

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

dorothy
  • 1,153
  • 4
  • 17
  • 35

1 Answers1

1

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)")
CL.
  • 165,803
  • 15
  • 203
  • 239