sql ="""INSERT INTO birthday(team, birthday)
VALUES ('Norway', {"2020-01-01": "Ram's BDay"}));"""
Above sql statement throws an error while inserting.
ProgrammingError: (1064, ‘You have an error in your SQL syntax; check
the manual that corresponds to your MySQL server ver
Based on manual attempts I know it is related to apostrophe. Is it possible to insert the above statement, I don’t have the control over apostrophe coming in the data stream.
2
Answers
You have a syntax mistake
If you are using more apostrophe be sure to add so it will not read
you must put the hole JSON String in quotes an escape them in the string
or you use single quotes then you must escape them in the string
SAMPLE