Cassandra:无法 store/view 时间戳为 yyyy-mm-dd HH:mmZ
Cassandra: Unable to store/view timestamp as yyyy-mm-dd HH:mmZ
我想存储和查看格式为 yyyy-mm-dd HH:mmZ 的时间戳列。我对 cqlshrc 文件中的 dattimeformat 进行了更改,并将其存储在 home 下的 .cassandra 文件夹中。以下是我所做的更改:
> [ui] ;; Whether or not to display query results with colors ; color =
> on
>
> ;; Used for displaying timestamps (and reading them with COPY)
>
> datetimeformat = %Y-%m-%d %H:%M%z
>
> ;; Display timezone timezone = Etc/UTC
>
> ;; The number of digits displayed after the decimal point for single
> and double precision numbers ;; (note that increasing this to large
> numbers can result in unusual values) ;float_precision = 5
> ;double_precision = 15
>
> ;; Used for automatic completion and suggestions ; completekey = tab
所以在 cql 中我创建了一个简单的临时文件 table 如下:
CREATE TABLE project_fvag.temp (
user_name timestamp PRIMARY KEY,
user_id decimal
)
现在,当我执行以下操作时:
insert insert into project_fvag.temp(user_time,user_id) values('1997-21-01 00:01Z',0.2);
我收到错误:
InvalidRequest: Error from server: code=2200 [Invalid query]
message="Unable to coerce '1997-21-01 00:01Z' to a formatted date
(long)"
另外,当我查看 table 的过去内容时,我看到数据为
user_time | user_id
---------------------------------+-----------
2017-10-10 14:20:56.000000+0000 | 0.2
2017-10-10 14:20:25.777000+0000 | 0.2
我想知道为什么 datetime yyyy-mm-dd HH:mmZ 格式不起作用?
datetimeformat
仅在cqlsh中显示日期和从命令复制时使用
Used for displaying timestamps (and reading them with COPY)
datetimeformat = %Y-%m-%d %H:%M:%S%z
我想存储和查看格式为 yyyy-mm-dd HH:mmZ 的时间戳列。我对 cqlshrc 文件中的 dattimeformat 进行了更改,并将其存储在 home 下的 .cassandra 文件夹中。以下是我所做的更改:
> [ui] ;; Whether or not to display query results with colors ; color =
> on
>
> ;; Used for displaying timestamps (and reading them with COPY)
>
> datetimeformat = %Y-%m-%d %H:%M%z
>
> ;; Display timezone timezone = Etc/UTC
>
> ;; The number of digits displayed after the decimal point for single
> and double precision numbers ;; (note that increasing this to large
> numbers can result in unusual values) ;float_precision = 5
> ;double_precision = 15
>
> ;; Used for automatic completion and suggestions ; completekey = tab
所以在 cql 中我创建了一个简单的临时文件 table 如下:
CREATE TABLE project_fvag.temp (
user_name timestamp PRIMARY KEY,
user_id decimal
)
现在,当我执行以下操作时:
insert insert into project_fvag.temp(user_time,user_id) values('1997-21-01 00:01Z',0.2);
我收到错误:
InvalidRequest: Error from server: code=2200 [Invalid query] message="Unable to coerce '1997-21-01 00:01Z' to a formatted date (long)"
另外,当我查看 table 的过去内容时,我看到数据为
user_time | user_id
---------------------------------+-----------
2017-10-10 14:20:56.000000+0000 | 0.2
2017-10-10 14:20:25.777000+0000 | 0.2
我想知道为什么 datetime yyyy-mm-dd HH:mmZ 格式不起作用?
datetimeformat
仅在cqlsh中显示日期和从命令复制时使用
Used for displaying timestamps (and reading them with COPY)
datetimeformat = %Y-%m-%d %H:%M:%S%z