Browsing through Cassandra tables in Hive

If a keyspace and table exists in Cassandra, you can query the keyspace and table in Hive.

If a keyspace and table exists in Cassandra, you can query the keyspace and table in Hive. For example, create a keyspace in Cassandra using cqlsh. Add some data to the table using cqlsh, and then access the data in Hive.

cqlsh> CREATE KEYSPACE cassandra_keyspace WITH replication =
         {'class': 'NetworkTopologyStrategy', 'Analytics': 1};
cqlsh> USE cassandra_keyspace;
cqlsh:cassandra_keyspace> CREATE TABLE exampletable
                            ( key int PRIMARY KEY , data text );
cqlsh:cassandra_keyspace> INSERT INTO exampletable (key, data )
                            VALUES ( 1, 'This data can be read
                              automatically in hive');
cqlsh:cassandra_keyspace> quit;

At this point, you can start Hive and query the keyspace and table in Hive.

hive> USE cassandra_keyspace;
hive> SHOW TABLES;
      OK
      exampletable
hive> SELECT * FROM exampletable;
      OK
      1 This data can be read automatically in hive