title: SQL in Python - using global variables
body: <p>I'm using <code>pymysql</code> package and need to write a query that will get 3 numeric variables that represent the specific date as: year month and day - and use them.</p>
  
  <p>This will look like this:</p>
  
  <pre><code>INSERT INTO tbl1 
  
  SELECT id, user_id, search_term
  FROM main_table 
  WHERE year = (var1) AND month = (var2) AND day = (var3);
  
  INSERT INTO tbl2 
  
  SELECT id,user_id, find_term
  FROM main_table 
  WHERE year = (var1) AND month = (var2) AND day = (var3);
  </code></pre>
  
  <p>I need that the 2 insert clauses will use the same var1, var2, var3 that i will define before executing the query.</p>
  
  <p>The thing is - in order to be effcient - i need to do it in the same run.
  I tried to use (%s) but the problem is the python asks me for 6 arguments and not only 3...</p>
  
  <p>Anyone know what could be helpful here? 
  Thank you!!!</p>