unable to coerce '2012/11/11' to a formatted date (long)

前端 未结 2 388
无人共我
无人共我 2021-01-20 20:35

I am new to Cassandra cql (cqlsh 4.1.1, Cassandra 2.0.8.39, CQL spec 3.1.1, Thrift protocol 19.39.0) - using the cql COPY command to a table from a CSV formatted file and I

2条回答
  •  失恋的感觉
    2021-01-20 21:29

    There is not a direct way to do that from within CQLSH.

    There are a certain set of string date formats which can be coerced. See the CQL Timestamp type documentation page for some examples like:

    yyyy-mm-dd HH:mm
    yyyy-mm-dd HH:mm:ss
    yyyy-mm-dd HH:mmZ
    yyyy-mm-dd HH:mm:ssZ
    yyyy-mm-dd'T'HH:mm
    yyyy-mm-dd'T'HH:mmZ
    yyyy-mm-dd'T'HH:mm:ss
    yyyy-mm-dd'T'HH:mm:ssZ
    yyyy-mm-dd
    yyyy-mm-ddZ
    

    As a workaround you could modify your CSV file to adjust the date format, then import it. (In your case it may be as simple as "yyyy/mm/dd" -> "yyyy-mm-dd".)

提交回复
热议问题