cassandra 如果不存在则添加列 [英] cassandra add column if not exists

查看:38
本文介绍了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 如果不存在则添加列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆