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
Post a Comment