how to execute a sql script in a mysql container via python?

So, I am executing a python script and I want to connect to a mysql container and execute a file, e.g. init.sql, within the python script.

Do you know how to write that command in python? The connection to the mysql database is already successful but I don’t know how to execute the script. Thank you very much!

Source: Docker Questions