dorothy
dorothy

Reputation: 1243

Sqlite3 statement creating table named parameters

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

Answers (1)

CL.
CL.

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

Related Questions