Forums

SQLAlchemy bindparams "Incorrect date value" error

I have a MySQL query as follows:

sql = 'select * from table where view_date in :dl'

Then I use text(sql).bindparams(dl=x) to bind the parameters, where x is a tuple of dates/datetimes. This works perfectly on my local machine but throws an error on PyAnywhere:

Warning: Incorrect date value: ''2014-09-07'' for column 'view_date' at row 1

for each of the date I passed in. I am very confused. What can possibly be wrong?

Could there be a difference in the mysql versions between your machine and PythonAnywhere? Or could it be to do with the locale settings, and date/time format representations?