Python SQLite near "?": syntax error -


another 1 of questions. i'm trying do:

self.table = 'table' = 'column' b = 'value'  c.execute('insert ? (?) values (?)', (self.table, a, b)) 

but i'm getting

<class 'sqlite3.operationalerror'>:near "?": syntax error 

at same time,

c.execute('insert {0} ({1}) values ({2})'.format(self.table, a, b)) 

works flawlessly, except security concerns.

i realize i'm not first 1 have issue, have yet find solution works me.

table names, column names cannot parameterized. try following instead.

self.table = 'table' b = 'value'  c.execute('insert {} ({}) values (?)'.format(self.table, a), (b,)) 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -