【发布时间】:2018-06-24 20:52:03
【问题描述】:
这是我的数据库结构
CREATE TABLE stack (
id UUID,
entrytime TIMESTAMP,
name TEXT,
PRIMARY KEY (id, entrytime)
) WITH CLUSTERING ORDER BY ( entrytime DESC );
当我使用 Insert 语句时。
INSERT INTO stack ( id, entrytime, name )
VALUES ( now(), toTimestamp( now() ), 'Nik' );
但是它将进入时间列存储为2018-01-15 08:29:58.174000+0000
我想删除 Cassandra 提供的额外精度。
我知道这与cqlshrc.sample 文件有关,但我做不到。
谁能帮帮我?
这是我的 cqlshrc 文件的一部分
[ui]
;; Whether or not to display query results with colors
; color = on
;; Used for displaying timestamps (and reading them with COPY)
time_format = %Y-%m-%d %H:%M:%S
;; Display timezone
;timezone = Etc/UTC
现在当我运行我的 cql shell 时会出现以下错误。
Traceback (most recent call last):
File "/var/www/html/cassandra/apache-cassandra-
3.11.1/bin/cqlsh.py", line 2434, in <module>
main(*read_options(sys.argv[1:], os.environ))
File "/var/www/html/cassandra/apache-cassandra-
3.11.1/bin/cqlsh.py", line 2211, in read_options
configs.read(CONFIG_FILE)
File "/usr/lib/python2.7/ConfigParser.py", line 305, in read
self._read(fp, filename)
File "/usr/lib/python2.7/ConfigParser.py", line 512, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
ConfigParser.MissingSectionHeaderError: File contains no section headers.
file: /home/ubuntu/.cassandra/cqlshrc, line: 1
'\xef\xbb\xbf;获得 Apache 软件基金会 (ASF) 的许可\n'
【问题讨论】: