The problem is with inserting json strings into MySQL database.
In my python program I obtain json as a result of json.dumps(d) where d is a dictionary. Inserting code is:
query = ("INSERT INTO bm_triesJsons VALUES (%s, %s, %s);"%
(article_id, revision_number, jsn))
print query
cur.execute(query)
It looks like the problem is quotes, there is no escape symbol in front of quotes.
How can I fix this?
Use the parameterized approach to values when doing a query. The driver will handle escapes:
If you want direct and manual access to the escape function MySQLdb uses, you can do it like this: