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,213
  • 5
  • 20
  • 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.
  • 173,858
  • 17
  • 217
  • 259