csvsql into mysql: uses Timestamp, need Datetime

159 Views Asked by At

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,
}
0

There are 0 best solutions below