gpt4 book ai didi

cassandra - 自定义 Cassandra /cqlsh time_format

转载 作者:行者123 更新时间:2023-12-01 13:50:05 25 4
gpt4 key购买 nike

系统:

CentOS 6.7 x86_64cqlsh 5.0.1 | Cassandra 2.2.1 | CQL 规范 3.3.0

我在插入(复制 csv 文件)格式为 '%d-%m-%Y %H:%M:%S' 的时间戳字段时遇到问题,

默认不支持这种格式,所以我在 ~/.cassandra/cqlshrc 文件中手动创建了它:

[ui]
time_format = %d-%m-%Y %H:%M:%S

再次启动cqlsh,还是无法插入:

system@cqlsh> insert into nir.nir_test (END_DATE) values ('01-09-2015 18:55:50');

InvalidRequest: code=2200 [Invalid query] message="Unable to coerce '01-09-2015 18:55:50' to a formatted date (long)"

有什么建议吗?

最佳答案

cqlshrc中的[ui]配置只影响输出格式。它会在您查询时间戳列时应用。例如:

select END_DATE from nir.nir_test;

可能输出:

 end_date
---------------------
01-09-2015 18:55:50

但对于插入,您需要使用 specified formats 之一.例如:

insert into nir.nir_test (END_DATE) values ('2015-09-01 18:55:50');

这可能意味着您需要先转换 CSV 文件中的时间戳,然后再尝试插入它们。

关于cassandra - 自定义 Cassandra /cqlsh time_format,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32496272/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com