Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cassandra 架构未完全从Thrift协议转换为CQL协议_Cassandra_Schema_Pycassa_Cassandra Python Driver - Fatal编程技术网

Cassandra 架构未完全从Thrift协议转换为CQL协议

Cassandra 架构未完全从Thrift协议转换为CQL协议,cassandra,schema,pycassa,cassandra-python-driver,Cassandra,Schema,Pycassa,Cassandra Python Driver,我正在尝试在我的项目中从使用pycassa转移到本机协议(这将让我们升级cassandra的版本)。我的模式是使用pycassa定义的,因此它使用compact storage创建了一个列族,它有3个列不是复合主键的一部分(我知道CQL协议不允许这样做) 我当前的Cassandra集群的版本是2.0.17。当我使用thrift协议“显示模式”时,模式是: create column family store with column_type = 'Standard' and c

我正在尝试在我的项目中从使用pycassa转移到本机协议(这将让我们升级cassandra的版本)。我的模式是使用pycassa定义的,因此它使用compact storage创建了一个列族,它有3个列不是复合主键的一部分(我知道CQL协议不允许这样做)

我当前的Cassandra集群的版本是2.0.17。当我使用thrift协议“显示模式”时,模式是:

create column family store
    with column_type = 'Standard'
    and comparator = 'CompositeType(org.apache.cassandra.db.marshal.ReversedType(org.apache.cassandra.db.marshal.LongType),org.apache.cassandra.db.marshal.AsciiType,org.apache.cassandra.db.marshal.AsciiType)'
    and default_validation_class = 'DoubleType'
    and key_validation_class = 'AsciiType'
    and column_metadata = [
       {column_name : 'something1',
       validation_class : AsciiType},
      {column_name : 'something2',
      validation_class : AsciiType}]

但是当我检查本机协议上的模式时,它缺少“column3”和“value”列。结果如下:

CREATE TABLE store (
  key ascii,
  column1 bigint,
  column2 ascii,
  something1 ascii,
  something2 ascii,
  PRIMARY KEY ((key), column1, column2)
) WITH COMPACT STORAGE AND
CLUSTERING ORDER BY (column1 DESC, column2 ASC)


现在,由于这种差异,我无法在客户端从pycassa转换到本机协议。我无法找到任何方法来克服这个问题,并确保本机协议看到正确的模式。你有什么建议我来解决这个问题吗

简而言之,更改表格,添加缺少的列

看起来您没有value或column3的任何列元数据。我不确定它们是什么类型,如果它们也是ascii,您应该能够执行以下操作:

ALTER TABLE store ADD column3 ascii;
ALTER TABLE store ADD value ascii;

我在商店里已经有很多数据了。如果我只是修改表,我怀疑这些数据是否会回到这个新模式,因为数据实际上已经存在于Thrift协议中。此外,Thrift协议已经在comparator和default_validation_类下具有值和第3列详细信息