1

I am trying to move from using pycassa to native protocol in my project (which will let us upgrade the version of cassandra). My schema was defined using pycassa so it created a Column family using compact storage and it has 3 columns which are not part of the composite primary key (I know this is not allowed by CQL protocol.)

The version of my current Cassandra cluster is 2.0.17. The schema when I do "show schema" using the thrift protocol comes to be:

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}]


But when I check the schema on the native protocol, it is missing "column3" and "value" columns. It comes out as follows:

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)


Now, because of this discrepancy, I cannot transition from pycassa to the native protocol on the client side. I haven't been able to find anything to overcome this problem and make sure that the native protocol sees the right schema. Is there anything you could suggest me to fix this?

Nitin
  • 280
  • 1
  • 4
  • 12

1 Answers1

1

In short alter the table adding the missing columns.

It looks like you don't have any of the column meta data for value or column3 I'm not sure what types they are if they are just ascii as well you should be able to do the following:

ALTER TABLE store ADD column3 ascii;
ALTER TABLE store ADD value ascii;
Jeff Beck
  • 3,944
  • 3
  • 28
  • 45
  • I already have a lot of data in the store. I doubt those data are gonna come back to this new schema if I just alter the Table because data actually already exists in Thrift protocol. Also, Thrift protocol already has the _value_ and _column3_ details under _comparator_ and _default_validation_class_ – Nitin Nov 02 '16 at 05:49