Skip to content
Advertisement

JSON Blob into SQL Server

I have data from a web API that I want to store in a SQL database. Each record in the web API looks like this:

>>> inci[1]
>>> Out[47]: 
{'@odata.etag': 'W/"97914784"',
 x

Advertisement

Answer

That query is invalid. Should be of the form INSERT INTO TableName(Column1, Column2) VALUES (?,?), so something like:

 cur.execute("""INSERT INTO IncidentBLOB(IncidentBLOB) VALUES (?)""", json.dumps(incident))
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement