title: DatabaseError: The first argument to execute must be a string or unicode query in python
body: <p>I am trying to return a date selected from date picker in to my sql query in my python code. I also tried using <code>encode(utf-8)</code> to remove the unicode string but still, I am getting the error. </p>
  
  <p>I am new to python. Can anyone please help me figure out how to solve this problem? I am using python flask to create the webpage</p>
  
  <pre><code>if request.method=='POST':
          dateval2 = request.form['datepick']
          dateval = dateval2.encode('utf-8')
      result = ("SELECT * FROM OE_TAT where convert(date,Time_IST)='?'",dateval
      df = pd.read_sql_query(result,connection)`
  </code></pre>
  
  <p><strong>Error</strong>:</p>
  
  <pre><code>pandas.io.sql.DatabaseError
  DatabaseError: Execution failed on sql '("SELECT * FROM OE_TAT where convert(date,Time_IST)='?'", '2015-06-01')': The first argument to execute must be a string or unicode query.
  </code></pre>