How to check if a Cassandra table exists

后端 未结 3 1422
南旧
南旧 2021-02-07 01:35

Is there an easy way to check if table (column family) is defined in Cassandra using CQL (or API perhaps, using com.datastax.driver)?

Right now I am leaning towards exec

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-07 01:59

    I just needed to manually check for the existence of a table using cqlsh. Possibly useful general info.

    describe keyspace_name.table_name
    

    If it doesn't exist you'll get 'table_name' not found in keyspace 'keyspace' If it does exist you'll get a description of the table.

提交回复
热议问题