1

I am trying to use csvkit / csvsql to import csv into mysql. csvkit detects the datetime columns correctly. It tries to create the table with the type TIMESTAMP, but I need DATETIME.

Is there any way to force using DATETIME instead of TIMESTAMP? I am trying to change it directly in the code (and I will eventually succeed) but it is quite silly.

Note: I edited agatesql/table.py:

SQL_TYPE_MAP = {
    agate.Boolean: None,  # See below
    agate.Number: None,  # See below
    agate.Date: DATE,

    #### Changed this from:
    # agate.DateTime: TIMESTAMP, 
    #### to:
    agate.DateTime: DATETIME, 

    agate.TimeDelta: None,  # See below
    agate.Text: VARCHAR,
}
Petr Blahos
  • 2,253
  • 1
  • 11
  • 14
  • +1 I am having the same problem. In my case it seems to be an issue with the mssql dialect defined in SqlAlchemy. I got it working by changing the return value of visit_TIMESTAMP to "DATETIME" which is very far from ideal. The strange thing is there are comments in there that acknowledge mssql timestamp isn't the same as standard SQL timestamp... surely there is a better way – JonM Apr 30 '20 at 13:41

0 Answers0