Skip to main content

Hello,

So I have been trying to INSERT a ‘0’ value date using a FeatureWriter with MariaDB/MySQL compatible format into our MySQL DB, but I can’t seem to be able to do it. I keep getting the message the row is skipped because an “Invalid date/time value”.

I have tried using many different values for the ‘0’ date like ‘0000-00-00’ , ‘00000000’ with and without the single quotes but I keep getting the same behavior. I’ve also tried using different types of fields (varchar, date, datetime) in FME (but always keeping datetime in the DB) and still the same.

I tried using 00010101 and that one was accepted and it did actually loaded into the DB without problems. In the DB the field is Nullable and also accepts cero values, but I can’t seem to get it to work from FME.

Any ideas?.

Thanks in advance.

RZ.-

Do you really mean 0 as in zero, or do you mean to insert a NULL value?


Hi ​@david_r 

Well, what I want to do is insert the following type of datetime: ‘00000000 00:00’

But I’ve tried that value as well in FME and it is not accepted by the FaetureWriter (MariaDB/MySQL format) as a valid value so the row is skipped and no data is written to the DB for that row.

Regards.

RZ.-


Sometimes Safe has not quite programmed the constraints for the Writers that recognise all valid data for that particular format.  I suspect this is a Bug in this case, although like ​@david_r  I would struggle to think of many valid use cases for setting a Date value to zero?  It would normally break all sorts of data conventions/downstream integrations.

You could probably workaround this by splitting off the Features with Date = 0 with a Tester to be instead written using SQLExecutor via a manually built statement using AttributeCreator for each Feature of  “INSERT INTO ..”
https://www.w3schools.com/mysql/mysql_insert.asp

 


Hi ​@bwn,

I actually had already thought about doing the split and using SQLExecutor to do the INSERT but I get the same result. Just to make sure I wasn’t crazy I test it with a different Date and that was accepted.

Which is why I turn to the community for help, because I couldn’t think of anything else to do or check.

Regards,

RZ.-


Reply