Sanitization Queries

by marcus.wong@keboola.com


Facts - can’t be NULL, ‘NULL’, or an emptry string.  must be 0.


UPDATE `out.c-main.table`

SET `fact` = ‘0’

WHERE `fact` IN (‘’,’NULL’)

OR

`fact` IS NULL

;


Dates - must be a valid date range, I preset everything without a date as 1970-01-01 00:00:00. Must be within valid GD range.



UPDATE `out.c-main.table`

SET `date` = '1970-01-01 00:00:00'

WHERE `date` IN ('','NULL','0000-00-00 00:00:00')

OR

`ship_date` IS NULL

;




Comments