engine = sqlalchemy.create_engine(
    'mysql+mysqlconnector://yourusername:yourpassword@yourhostname.com/your_database'
    )
db = engine.connect()
weird_string = '~!@#$%^&*()_+`1234567890-={}|[]\\;\':"'
sql = text('INSERT INTO penguins (msg) VALUES (:msg)')
insert = db.execute(sql, msg=weird_string)
db.close()
Python MySQL escape special characters