SQLITE3 + execute Insert -
this question has answer here:
- sqlite parameter substitution problem 7 answers
trying execute insert item coming list:`
item=u'sunil goyal'
c.execute('''insert bpersons(person_name) values (?)''',item)`
is simple enough, returns
incorrect number of bindings supplied. current statement uses 1, , there 11 supplied.
clearly instead of reading item 1 element, reading characters. there no problem earlier code returns list:
>>> if meta[7]:#bcoz list empty item in meta[7]: print item
sunil goyal
rehan yar khan
khan
kae capital
ashish shankar
karthik reddy
feroze azeez
len(meta[7]) 7
any idea going wrong?
insert
looking iterable (documentation) , succeeds because unicode string iterable, should put inside of tuple or list handled sqlite3.
c.execute('''insert bpersons(person_name) values (?)''',(item,))`
Comments
Post a Comment