Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add NOT NULL constraint for column in Cassandra?

I'm creating a table in Cassandra key space, i want to add NOT NULL constraint for one column in table. I've googled for that but didn't find any answer. Does Cassandra supports all functions supported by Relational Databases?

like image 458
Uday Avatar asked Jan 23 '26 20:01

Uday


1 Answers

Why do you want to add that constraint? This would defeat the purpose of the "new" storage engine where you can dynamically add columns to tables. However, back to your question you can specify WITH COMPACT ENGINE when creating the table. That will effectively force you to insert a value in all the columns of the table.

BTW, Cassandra is a very different beast. It is not a relational database, you should look carefully at your requirements before everything else.

like image 71
xmas79 Avatar answered Jan 27 '26 02:01

xmas79



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!