JSON insert error, Sqlite3, Python -


i trying insert raw json strings sqlite database using sqlite3 module in python.

when following:

rows = [["a", "<json value>"]....["n", "<json_value>"]] cursor.executemany("""insert or ignore features(uid, json) values(?, ?)""", rows) 

i following error:

sqlite3.programmingerror: incorrect number of bindings supplied. current statement uses 2, , there 48 supplied.

how can insert raw json table? assume it's commas in json string.

how can around this?

second argument passed executemany() has list of touples, not list of lists:

[tuple(l) l in rows] 

from sqlite3 module documentation:

put ? placeholder wherever want use value, , provide tuple of values second argument cursor’s execute() method.

the same applies executemany().


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -