Using python, json, and pyodbc, is there a python function to store a json object in a Text field in a SQL database?
For example:
cnxn = pyodbc.connect( MY CONNECTION STRING )
cursor = cnxn.cursor()
cursor.execute("UPDATE TABLE1 SET FIELD1 = '" + json.dumps(pythonDictionary) + "' WHERE FIELD2 = 'some value'")
I always get syntax error because i am not properly escaping the special symbols in the json object, i simply want that json dump to be converted to proper sql string, is there a function in python to do that?!