Sunday, 12 January 2020

Cassandra: Drop keyspace if it exists


If you are trying to drop a keyspace, that is not exists, you will get an error like ConfigurationException: Cannot drop non existing keyspace 'cassandratutorial'.

Use the command ‘DROP KEYSPACE IF EXISTS’ to drop the keyspace only if it exist. This command deletes the keyspace, if it exists only, else it ignore.

Syntax
DROP KEYSPACE IF EXISTS keyspace_name

Example
DROP KEYSPACE IF EXISTS cassandratutorial;

Previous                                                    Next                                                    Home

No comments:

Post a Comment