csvsql: dateutils.parse gives false positive for certain strings
Created by: fitnr
I've run into a problem where csvsql
mistakenly casts certain fields as TIME. If a column contains only "A", "M", and "AM", csvsql
will consider it a TIME column.
I think I've identified the use of dateutils.parse
in typeinference.py as the root of the problem.
This is an issue with dateutil, and has been fixed as of v2.4.2. So the best fix will be to update the requirements.
If updating to dateutils@2.4.2 isn't possible, my suggested fix is to add a check if the parsed datetime exactly matches the given default. This will have the side effect of making it impossible to properly recognize a valid data field containing 9999-12-31 00:00:00.