Showing posts with label keyspace. Show all posts
Showing posts with label keyspace. Show all posts

Thursday, 13 February 2020

Cassandra: Get All the tables in a keyspace

'DESCRIBE TABLES' command is used to get all the tables in a keyspace.

cqlsh> USE cassandratutorial;
cqlsh:cassandratutorial> 
cqlsh:cassandratutorial> DESCRIBE TABLES;

employee

cqlsh:cassandratutorial> 
cqlsh:cassandratutorial> DESC TABLES;

employee

cqlsh:cassandratutorial>


Previous                                                    Next                                                    Home

Wednesday, 22 January 2020

Cassnadra: List all tables in a keyspace

‘DESCRIBE TABLES’ or ‘DESC TABLES’ command is used to list all tables in a keyspace.

cqlsh> DESC KEYSPACES;

system_schema  system             system_distributed
system_auth    cassandratutorial  system_traces     

cqlsh> 
cqlsh> USE system;
cqlsh:system> 
cqlsh:system> DESC TABLES;

available_ranges          peers               batchlog        transferred_ranges
batches                   compaction_history  size_estimates  hints             
prepared_statements       sstable_activity    built_views   
"IndexInfo"               peer_events         range_xfers   
views_builds_in_progress  paxos               local


Previous                                                    Next                                                    Home

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

Cassandra: Drop or delete keyspace


You can use 'DROP KEYSPACE' command to drop a keyspace. Once you execute the 'DROP KEYSPACE' command, it removes everything (including tables, functions, data in the keyspace).

Syntax
DROP KEYSPACE [IF EXISTS] keyspace_name

What if you are trying to drop a keyspace, which is not existed anymore?
You will get an error like 'ConfigurationException: Cannot drop non existing keyspace 'cassandratutorial'.

cqlsh> DROP KEYSPACE cassandratutorial;
ConfigurationException: Cannot drop non existing keyspace 'cassandratutorial'.



Previous                                                    Next                                                    Home