title: Python: best practice and securest way to connect to MySQL and execute queries
body: <p>What is the safest way to run queries on MySQL? I am aware of the dangers involved with MySQL and SQL injection.</p>
  <p>However, I do not know how I should run my queries to prevent injection on the variables to which other users (webclients) can manipulate. I used to write my own escape function, but apparently this is &quot;not-done&quot;.</p>
  <p>What should I use and how should I use it to query and do inserts safely on a MySQL database through python without risking MySQL injection?</p>