cassandra add column if not exists

夙愿已清 提交于 2019-12-20 17:39:59

问题


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:


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.



来源:https://stackoverflow.com/questions/25728944/cassandra-add-column-if-not-exists

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!