I am trying to create a .sql file containing insert statement from a table. Basically, I get the data from one table, do some modification, then create insert statement from a list of dict and write it to a file. However, the issue is with the text field. The values are not escaped. Is there any utility/helper function that can help me get the insert statement with the handling of escape characters.
Maybe you should use text.replace('', '') to escape characters that do not fit in the SQL query.
Creating insert into mysql script