Background, there are several ways to store dates in MySQ.
- As a string e.g. "09/09/2009".
- As integer using the function UNIX_TIMESTAMP() this is supposedly the traditional unix time representation (you know seconds since the epoch plus/minus leap seconds).
- As a MySQL TIMESTAMP, a mysql specific data type not the same than unix timestamps.
As a MySQL Date field, another mysql specific data type.
It's very important not to confuse case 2 with case 3 (or case 4). I have an existing table with an integer date field (case 2) how can I define it in sqlalchemy in a way I don't have to access mysql's "FROM_UNIXTIME" function?
For the record, just using sqlalchemy.types.DateTime and hoping it does the right thing when it detects an integer column doesn't work, it works for timestamp fields and date fields.