cql3

How to bind IN-clause values in a CQL 3 prepared statement?

早过忘川 提交于 2019-12-01 21:06:36
I have a table that is roughly like create table mytable ( id uuid, something text, primary key (id) ); I'm trying to create a prepared statement that has a bound in-clause: PreparedStatement ps = session.prepare("select * from mytable where id IN (?)"); ... UUID[] ids = { uuid1, uuid2, uuid3} ; No matter how I express the ids to bind, the java driver rejects them. ps.bind( /*as array*/) : driver complains statement has only one value, 2 supplied ps.bind( /*as comma separated string list of uuids*/) : driver complains it wants UUID.class objects, not strings ps.bind( /*as list object*/) :

Cassandra - Overlapping Data Ranges

不想你离开。 提交于 2019-12-01 19:44:31
I have the following 'Tasks' table in Cassandra. Task_ID UUID - Partition Key Starts_On TIMESTAMP - Clustering Column Ends_On TIMESTAMP - Clustering Column I want to run a CQL query to get the overlapping tasks for a given date range. For example, if I pass in two timestamps (T1 and T2) as parameters to the query, I want to get the all tasks that are applicable with in that range (that is, overlapping records). What is the best way to do this in Cassandra? I cannot just use two ranges on Starts_On and Ends_On here because to add a range query to Ends_On, I have to have a equality check for

rename keyspace and columnfamily in cassandra 1.2

怎甘沉沦 提交于 2019-12-01 11:52:26
How to rename keyspace and columnfamily in cassandra 1.2? I know that cassandra-cli rename api is no longer supported - How to rename keyspace in Cassandra . Maybe there are some api in CQL3? Or some api for creating new columnfamily and coping all data from old to new columnfamily? Richard Renaming is disabled internally, not just within the thrift API. So there isn't a CQL command to do it either. However, there is a manual process which is described here: https://issues.apache.org/jira/browse/CASSANDRA-1585 For rename only a column family also you can follow the next instructions: http:/

Cassandra CQL select query not returning records which have timestamp as clusterkey

纵然是瞬间 提交于 2019-12-01 11:05:05
Cassandra CQL: Table created with composite key and cluster key. When I try to execute select * from partition key then I able to retrieve all data and it works for relational operator ( < or > ) too . But when I queried for particular cluster key using equal-to(=) operator with proper value it returns 0 rows. Table: CREATE TABLE entity_data ( received_date timestamp, entity text, received_time timestamp, node int, primary key ((received_date ,entity),received_time)); Data ( select * from entity): received_date | entity | received_time | node_id 2014-09-24 00:00:00+0400 | NA | 2014-09-24 18:56

rename keyspace and columnfamily in cassandra 1.2

倖福魔咒の 提交于 2019-12-01 11:04:47
问题 How to rename keyspace and columnfamily in cassandra 1.2? I know that cassandra-cli rename api is no longer supported - How to rename keyspace in Cassandra. Maybe there are some api in CQL3? Or some api for creating new columnfamily and coping all data from old to new columnfamily? 回答1: Renaming is disabled internally, not just within the thrift API. So there isn't a CQL command to do it either. However, there is a manual process which is described here: https://issues.apache.org/jira/browse

Cassandra CQL select query not returning records which have timestamp as clusterkey

不问归期 提交于 2019-12-01 07:51:44
问题 Cassandra CQL: Table created with composite key and cluster key. When I try to execute select * from partition key then I able to retrieve all data and it works for relational operator ( < or > ) too . But when I queried for particular cluster key using equal-to(=) operator with proper value it returns 0 rows. Table: CREATE TABLE entity_data ( received_date timestamp, entity text, received_time timestamp, node int, primary key ((received_date ,entity),received_time)); Data ( select * from

Cassandra pagination: How to use get_slice to query a Cassandra 1.2 database from Python using the cql library

北战南征 提交于 2019-12-01 05:06:05
问题 I have a Cassandra 1.2 cluster and I'm using it from Python using the cql library. Now I need to implement some paging functionality that seems pretty straightforward using get_slice, but I can't find any documentation on how to use something like this from the cql library: get_slice("key" : table_key, "column_parent" : {"column_family" : "MyColumnFamily"}, "predicate" : { "slice_range" : { "start" : "SomeStartID", "end" : "Z", "reverse" : "false", "count : "100" } } ) I've seen this type of

how to perform “not in” filter in cql3 query select?

烂漫一生 提交于 2019-12-01 04:18:59
I need to fetch rows without specific keys. for sample: select * from users where user_id not in ("mikko"); I have tried with "not in" and this is the response: Bad Request: line 1:35 no viable alternative at input 'not' Zanson "not in" is not a supported operation in CQL. Cassandra at its heart is still based on key indexed rows. So that query is basically the same as "select * from users", as you have to go through every row and figure out if it does not match the in. If you want to do that type of query you will want to setup a map reduce job to perform it. When using Cassandra what you

Creating column family or table in Cassandra while working Datastax API(which uses new Binary protocol)

北城以北 提交于 2019-11-30 21:08:37
I have started working with Cassandra database. I am planning to use Datastax API to upsert/read into/from cassandra database. I am totally new to this Datastax API (which uses new Binary protocol) and I am not able to find lot of documentations as well which have some proper examples. When I was working with Cassandra CLI using the Netflix client(Astyanax client), then I created the column family like this- create column family profile with key_validation_class = 'UTF8Type' and comparator = 'UTF8Type' and default_validation_class = 'UTF8Type' and column_metadata = [ {column_name : crd,

Cassandra selective copy

跟風遠走 提交于 2019-11-30 18:17:37
I want to copy selected rows from a columnfamily to a .csv file. The copy command is available just to dump a column or entire table to a file without where clause. Is there a way to use where clause in copy command? Another way I thought of was, Do "Insert into table2 () values ( select * from table1 where <where_clause> );" and then dump the table2 to .csv , which is also not possible. Any help would be much appreciated. There are no way to make a where clause in copy, but you can use this method : echo "select c1,c2.... FROM keySpace.Table where ;" | bin/cqlsh > output.csv It allows you to