cassandra add column if not exists

2019-03-19 04:08发布

I need to insert a new column into an existing column family via a CQL script.

I want to do something like:

alter COLUMNFAMILY rules ADD rule_template text IF NOT EXISTS;

How can I achieve this purely in CQL script?

1条回答
Ridiculous、
2楼-- · 2019-03-19 04:15

There is no optional "if not exists" for altering column families (tables). As a workaround you could just execute the alter command and ignore the error if the column already exists. There shouldn't be any harm in it, other than the error message.

查看更多
登录 后发表回答