Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to view all tables in CQL and CQLSH?

I'm trying to explore the database and want to see all tables that exist there. What's the command that's equivalent to SHOW TABLES; in SQL?

like image 347
Ahmad Farid Avatar asked Jul 10 '18 21:07

Ahmad Farid


People also ask

How do you get all the tables in Cassandra?

To list all the tables (only the table names), DESC tables; To list all the tables and the schemas (CQL creation statements), DESC {$KEYSPACE_NAME} whereas {$KEYSPACE_NAME} is the name of the keyspace.

How do I see all Cassandra databases?

Go to data tab > there you will see all keyspcaces created by you and some system keyspaces. You can see all tables under individual keyspaces and also replicator factor for keyspace.

How do I Desc a table in Cassandra?

DESCRIBE TABLES Output the names of all tables in the current keyspace, or in all keyspaces if there is no current keyspace. DESCRIBE TABLE [.] Output CQL commands that could be used to recreate the given table. In some cases, as above, there may be table metadata which is not representable and which will not be shown.

Where are Cassandra tables stored?

Cassandra provides fine-grained control of table storage on disk. On packaged installations, the data files are stored in the same format, but in /var/lib/cassandra/data by default.


2 Answers

Depending on the version of Cassandra, the following may work for you

SELECT * FROM system_schema.tables

Check out the other tables in the system_schema keyspace to see what other info you can get

like image 132
adinas Avatar answered Sep 19 '22 18:09

adinas


to get all table names : DESC tables;

to get detailed view of a table : DESC table <table_name>;

to get detailed view of all tables in a keyspace : DESC keyspace <keyspace_name>;

like image 39
Laxmikant Avatar answered Sep 22 '22 18:09

Laxmikant