i wanna connect to Redash via Python code and execute some mysql query in this code and get in program the result of query. How can i realize it?

To do this you’ll need the Python Query Runner. Here’s a great blog post about it.

Note that the Python Query Runner is only available for Open Source users. We don’t have it enabled on the SaaS product.