Migrating DDL from Cassandra to YugabyteDB YCQL

162 Views Asked by At

[Question posted by a user on YugabyteDB Community Slack]

I am trying to migrate DDLs from apache cassandra to YugabyteDB YCQL . But I am getting this error:

cassandra@ycqlsh:killrvideo> CREATE TABLE killrvideo.videos (
              ...                   video_id timeuuid PRIMARY KEY,
              ...                   added_date timestamp,
              ...                   title text
              ...               ) WITH additional_write_policy = '99p'
              ...                   AND bloom_filter_fp_chance = 0.01
              ...                   AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
              ...                   AND cdc = false
              ...                   AND comment = ''
              ...                   AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
              ...                   AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
              ...                   AND crc_check_chance = 1.0
              ...                   AND default_time_to_live = 0
              ...                   AND extensions = {}
              ...                   AND gc_grace_seconds = 864000
              ...                   AND max_index_interval = 2048
              ...                   AND memtable_flush_period_in_ms = 0
              ...                   AND min_index_interval = 128
              ...                   AND read_repair = 'BLOCKING'
              ...                   AND speculative_retry = '99p';
SyntaxException: Invalid SQL Statement. syntax error, unexpected '}', expecting SCONST
CREATE TABLE killrvideo.videos (
                  video_id timeuuid PRIMARY KEY,
                  added_date timestamp,
                  title text
              ) WITH additional_write_policy = '99p'
                  AND bloom_filter_fp_chance = 0.01
                  AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
                  AND cdc = false
                  AND comment = ''
                  AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
                  AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
                  AND crc_check_chance = 1.0
                  AND default_time_to_live = 0
                  AND extensions = {}
                  ^
                  AND gc_grace_seconds = 864000
                  AND max_index_interval = 2048
                  AND memtable_flush_period_in_ms = 0
                  AND min_index_interval = 128
                  AND read_repair = 'BLOCKING'
                  AND speculative_retry = '99p';
 (ql error -11)

Are these optional parameters after the create table not supported in YugabyteDB (pulled from describing keyspace killrvideo). Not sure what I am missing here? Any help is really appreciated

1

There are 1 best solutions below

0
On BEST ANSWER

Please have a look at: https://docs.yugabyte.com/latest/api/ycql/ddl_create_table/#table-properties-1 You can remove everything starting from with which will probably allow you to create the table.

Taking this statement from the docs:

The other YCQL table properties are allowed in the syntax but are currently ignored internally (have no effect). (other are properties that do not deal with a limited set of table properties for the YCQL engine)

The probable reason you are getting this error is that you use properties that are specific to stock cassandra, and are not implemented in YugabyteDB, because they use a different storage layer.