0

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
1
  • JSON should probably be nvarchar(max). If the property names are fixed you can read into proper column using OPENJSON Commented Dec 9, 2021 at 1:03

1 Answer 1

1

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))
Sign up to request clarification or add additional context in comments.

1 Comment

Your result wans't working at first, but then I changed the column type to nvarchar instead of varBinary and it now works. Thank you for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.