I am constructing queries involving MSTimeStamp fields in MySQL and am being receiving "Incorrect datetime value" warnings even in situations where my queries are valid in MySQL.
How do I modify the following query so that sqlalchemy will accept it without warning: session.query(MyClass.id).filter(MyClass.timestamp > (func.now() - 20000)).first() ? The generated sql is SELECT my_table.id AS my_table_id FROM my_table WHERE my_table.timestamp > now() - %s LIMIT 0, 1 The warning I get is /usr/lib/pymodules/python2.5/sqlalchemy/engine/default.py:123: Warning: Incorrect datetime value: '20100209953011.000000' for column 'timestamp' at row 1 cursor.execute(statement, parameters) Why is sqlalchemy even seeing the value '20100209953011.000000', which is the outcome of the now() - 20000 operation inside the query? I tried changing (func.now() - 20000) to func.timestamp (func.now() - 20000) but I still get the same warning. If I change 20000 to 200, I don't get warned. Why would this be? It works with no warning if I change it to session.query(MyClass.id).filter(func.now() - MyClass.timestamp > 20000).first() , but that is not an acceptable solution because now MySQL can't use my index on MyClass.timestamp. I am using SQLA .5.5 -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.