Reputation: 3820
If I use the cqlsh
tool that comes with Cassandra 3, it can tell me if a table was created WITH COMPACT STORAGE
. All I have to do is describe table_name;
and it shows me the CQL used to create the table.
The describe
functionality is a feature of cqlsh
, not of the CQL language. I need to determine if a table uses compact storage using just CQL. What do I need to query in the system_schema
to determine if a table is using compact storage?
Upvotes: 1
Views: 673
Reputation: 3820
From the definition of the TableMetadataV3
class in the cassandra driver for python, the logic for determining compact storage is as follows
flags = row.get('flags', set())
if flags:
compact_static = False
table_meta.is_compact_storage = 'dense' in flags or 'super' in flags or 'compound' not in flags
is_dense = 'dense' in flags
else:
compact_static = True
table_meta.is_compact_storage = True
is_dense = False
The row
object is a dictionary that is the result of the query "SELECT * FROM system_schema.tables"
So to determine if a table uses compact storage, the following steps are necessary.
Select flags from system_schema.tables where keyspace_name=? and table_name=?
. Substitute the keyspace and table in as parametersUpvotes: 1