cql

Executing CQL through Shell Script?

梦想与她 提交于 2020-08-03 12:55:10
问题 I am trying to execute the CQL commands from shell script. I am able to connect to the cqlsh (CQL version i'm using is 1.1.18) but unable to send the queries to cql. Any ideas or suggestion how to proceed on this? Do I need to connect to Cassandra and execute few commands (select/update ) with shell script ?? 回答1: cqlsh -e "select * from ks.table limit 1;" > ~/output 回答2: I'm not sure about Cassandra 1.1.18, but you should be able to accomplish this with the -f flag of cqlsh . Let's say have

cassandra lookup by list of primary keys in java

梦想的初衷 提交于 2020-07-30 03:08:47
问题 I am implementing a feature which requires looking up Cassandra by a list of primary keys. Below is an example data where id is primary key mytable id column1 1 423 2 542 3 678 4 45534 5 435634 6 2435 7 678 8 4564 9 546 Most of my queries a lookup by id, but for some special cases I would like to get data for a list of ids. The way I am currently doing is a follows: public Object fetchFromCassandraForId(int id); int ids[] = {1, 3, 5, 7, 9}; List<Object> results; for(int id: ids) { results.add