I am trying to return a date selected from date picker in to my sql query in my python code. I also tried using encode(utf-8)
to remove the unicode string but still, I am getting the error.
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
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)`
Error:
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.