【问题标题】:new column added to columnfamily in cassandra-cli is not visible from cqlsh (cql3)从 cqlsh (cql3) 中看不到添加到 cassandra-cli 中的列族的新列
【发布时间】:2013-06-26 00:32:37
【问题描述】:

我在cql3中定义了一个表。描述它会返回以下内容:

CREATE TABLE 结果(
id uuid 主键,
案例名称文本,
结果文本,
运行 int,
用户文本
) 与...

我尝试使用它不应该限制列族的事实并添加一个新的列值对:

insert into results (id, sogginess) values(3d6f63a4-c1e0-4dd8-b043-8e0754122f23, 'high') ;

但这不起作用。如果我使用 cassandra-cli,我可以使用标准集语法添加 sogginess 的值,并且该行正常保留。即使切换回 cql3,select * 查询也不会返回这个新列,也没有 describe 显示新列 sogginess。

这意味着您不能将任意数据添加到 cql3 中的行并且您受定义的架构的约束?如果没有,我该怎么办?

【问题讨论】:

    标签: cassandra cql3 cassandra-cli cqlsh


    【解决方案1】:

    TL;DR;
    不,但您可以使用集合:phonenumbers set<text>

    CQL 3 要求在元数据中定义所有列,所以是的,您已绑定到模式。

    如果没有,我该怎么办?

    好吧,你不能。您可以做的是使用集合并构建您的数据模型。通过 thrift 添加任意列被认为是不好的做法。我的建议是阅读 datastax 在wide row support in CQL3 上的文章。这些问题也是相关的(如果不重复的话......)所以看看它们:

    1. Does cql3 require a schema for cassandra now
    2. Create a table in Cassandra 1.2 with CQL3 where column names will be created at runtime

    【讨论】:

      猜你喜欢
      • 2014-03-03
      • 1970-01-01
      • 2013-09-01
      • 2014-04-08
      • 2014-04-11
      • 2014-03-21
      • 1970-01-01
      • 2011-09-11
      • 1970-01-01
      相关资源
      最近更新 更多