Reputation: 1031
I have a cassandra database in which columns can be added or removed based on the application need. The column names start with the prefix RSSI
. I was wondering if it is possible to select all columns where the column name is like %RSSI%
. In MYSQL you can do something like select count(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name ='MACTrain' AND column_name LIKE '%RSSI%'
. Is it possible in cassandra ? If not what can be a solution to select columns based on a specific wildcard.
Upvotes: 1
Views: 578
Reputation: 6600
You can obtain the columns metadata of a table by querying the system
keyspace:
select * from system.schema_columns
where keyspace_name = 'yourks' and columnfamily_name = 'yourtable';
For Cassandra v3.0 and above, you can use the new system_schema
keyspace:
select * from system_schema.columns
where keyspace_name = 'yourks' and table_name = 'yourtable';
Upvotes: 2