Cassandra list keyspaces
- how to delete keyspace in cassandra
- describe keyspace cassandra
- how to drop keyspace in cassandra
- cassandra remove keyspace
Delete column in cassandra.
Cassandra truncate all tables in keyspace
Cassandra - Drop Keyspace
Dropping a Keyspace
You can drop a KeySpace using the command DROP KEYSPACE. Given below is the syntax for dropping a KeySpace.
Syntax
DROP KEYSPACE <identifier>i.e.
DROP KEYSPACE “KeySpace name”Example
The following code deletes the keyspace tutorialspoint.
cqlsh> DROP KEYSPACE tutorialspoint;Verification
Verify the keyspaces using the command Describe and check whether the table is dropped as shown below.
cqlsh> DESCRIBE keyspaces; system system_tracesSince we have deleted the keyspace tutorialspoint, you will not find it in the keyspaces list.
Dropping a Keyspace using Java API
You can create a keyspace using the execute() method of Session class.
Follow the steps given below to drop a keyspace using Java API.
Step1: Create a Cluster Object
First of all, create an instance of Cluster.builder class of com.datastax.driver.core package as shown below.
//Creating Cluster.Builder object Cluster.Builder builder1 = Cluster.builder();Add a contact point (IP address of the node) using the addContactPoint() metho