本文介绍了cassandra添加列(如果不存在)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要通过CQL脚本在现有列族中插入新列。
I need to insert a new column into an existing column family via a CQL script.
我想做以下事情:
alter COLUMNFAMILY rules ADD rule_template text IF NOT EXISTS;
我怎么能纯粹在CQL脚本中实现这一目标?
How can I achieve this purely in CQL script?
推荐答案
没有用于更改列族(表)的可选如果不存在。作为解决方法,您可以只执行alter命令,如果该列已存在,则忽略该错误。除了错误消息外,其中应该没有任何危害。
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.
这篇关于cassandra添加列(如果不存在)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!