python-mysql-replication icon indicating copy to clipboard operation
python-mysql-replication copied to clipboard

datetime '0000-00-00' return string '0000-00-00'

Open seanlook opened this issue 8 years ago • 0 comments

'0000-00-00 00:00:00' is a invalid datetime but it can be inserted in datetime column type. If I have f_time datetime NOT NULL defined, the parsed value in row event is set to None: row_event.py: __read_datetime2()

Then I use all column values to insert/update, that None value would lead to no data matched, or insert a null value to NOT NULL columns(error occurs).

We all know datetime '0000-00-00' is nasty but when it already exists, we shall keep the data consistent. It's nice if a parameter like date_tostr is given to BinlogStreamReader to decide the behavior.

I've implemented this, I will make a pull request later.

seanlook avatar Aug 29 '17 14:08 seanlook