how to create and execute a stored procedure in single store via a python script
This part of the documentation talks about how to connect with Python.
To create an SP, build it as a string in Python and execute the string (use an “execute” method in one of the Python APIs).
Then to call the stored procedure, “execute” a CALL statement like “call myProc()”.
Also, you may want to use ECHO instead of CALL if your SP returns a value.