title: passing python variable to sql statement psycopg2 pandas
body: <p>I am trying to replace a piece of sql code with a python variable that I will ask a user to generate using a raw_input. </p>
  
  <p>Below is the code i'm using which works great if I set <code>mypythonvariable</code> manually i.e. inputting <code>344</code> into the sql code, but if I set the sql as is to <code>mypythonvariable</code> it doesn't work.  </p>
  
  <p>The whole sql query is then converted into a pandas dataframe for further messing about with. </p>
  
  <p>Any help on how to do  be appreciated.</p>
  
  <p>UPDATE: I just added the <code>%s</code> code into the statement and i'm now getting the error message '': not all arguments converted during string formatting
  '</p>
  
  <pre><code>conn = pg.connect(host = "localhost",
                          port = 1234,
                          dbname = "somename",
                          user = "user",
                          password = "pswd")
  mypythonvariable = raw_input("What is your variable number? ")
  
  sql = """
  SELECT
      somestuff
  FROM
     sometable
  WHERE
     something = %s
  """
  df = pd.read_sql_query(sql, con=conn,params=mypythonvariable)
  </code></pre>