cql

How can I get the primary keys of all records in Cassandra?

左心房为你撑大大i 提交于 2019-12-11 03:49:21
问题 I have inserted plenty of data into Cassandra. Now I'd like to randomly query one record. But I don't know the primary key . So I want a way to fetch the primary keys of all data in Cassandra,then I can use one random primary key to query the data. Can I get it from the data directory of Cassandra? I only found .db files in that directory. 回答1: Which version of Cassandra are you on? If you're on Cassandra 3, you could query system_schema.columns from the command line, and grep for the PRIMARY

Cassandra CQL paging for Composite key

爱⌒轻易说出口 提交于 2019-12-11 03:36:05
问题 Is there is any easy way to query wide row by paging. My schema is, CREATE TABLE USER_LIKED_ITEMS ( user_id text, event_id text, item_id text, description text, PRIMARY KEY(user_id, event_id, item_id) ); I want to get all the rows for the given user_id (consider there are 500000 rows for a given user_id with various combination of event_id and item_id) through paging with a count 25. The query I have tried is select * from USER_LIKED_ITEMS where user_id = '101' LIMIT 25; Once results is

Can an index be created on a UUID Column?

…衆ロ難τιáo~ 提交于 2019-12-11 03:25:46
问题 Is it possible to create an index on a UUID/TIMEUUID column in Cassandra? I'm testing out a model design which would have an index on a UUID column, but queries on that column always return 0 rows found. I have a table like this: create table some_data (site_id int, user_id int, run_id uuid, value int, primary key((site_id, user_id), run_id)); I create an index with this command: create index idx on some_data (run_id) ; No errors are thrown by CQL when I create this index. I have a small bit

cassandra - The same query work with cql but not with python driver

五迷三道 提交于 2019-12-11 02:36:25
问题 I have a strange problem here. I have a cassandra table called events_prime and I want to request the DB to get elements from this table with a WHERE clause. I am using the python cassandra-driver and this is my request: prep_stment = session.prepare(""" SELECT * FROM events_prime WHERE "websiteId" = '%s-%s' AND churner=True AND "currentTime" > '%s' AND "currentTime" < '%s' LIMIT 20000; """%(platform,client,time_2,time_1)) print prep_stment print "Request DB..." frames = [] for res in session

Cassandra CQL SELECT/DELETE issue due to primary key constraints

匆匆过客 提交于 2019-12-11 02:30:01
问题 I need to store latest updates that needs to be pushed to users' newsfeed page in Cassandra table for later retrieval and my table's schema is as follow: CREATE TABLE newsfeed (user_name text, post_id bigint, post_type text, favorited boolean, shared boolean, own boolean, date timestamp, PRIMARY KEY (user_name,date,post_id,post_type) ); The first three column (username, postid, and posttype) in combination will build the actual primary-key of the table, however since I wanted to ORDER the

Deleting in cassandra cql table using IN operator

我的未来我决定 提交于 2019-12-11 02:03:36
问题 I have a cql table with the following schema CREATE TABLE temp_date_time_wise ( date text, timeuid timeuuid, temperature text PRIMARY KEY (date, timeuid) ) I understood the feasibility of using IN operator by following the below link http://mechanics.flite.com/blog/2014/01/08/the-in-operator-in-cassandra-cql/ Now when i try perform a delete operation by using IN operator for the clustering key as the following delete from temp_date_time_wise where date in ('2014-11-17 00:00:00.0') and timeuid

Inserting special characters

丶灬走出姿态 提交于 2019-12-11 01:35:11
问题 I'm trying to insert special characters in my Cassandra table but I couldn't insert it. Inserting data in table with umlaut is not possible As mentioned in the link i tried above link even though my character set is UTF8 as mentioned.I'm not able to insert. I've tried using quotes also still didn't work CREATE TABLE test.calendar ( race_id int, race_start_date timestamp, race_end_date timestamp, race_name text, PRIMARY KEY (race_id, race_start_date, race_end_date) ) WITH CLUSTERING ORDER BY

How does CqlConfigHelper.setOutputCql() work?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 23:05:01
问题 I am following the hadoop_cql3_word_count example in Cassandra and have questions with the following code segment: String query = "UPDATE " + KEYSPACE + "." + OUTPUT_COLUMN_FAMILY + " SET count_num = ? "; CqlConfigHelper.setOutputCql(job.getConfiguration(), query); My questions are: What is the definition of the question mark (i.e., ? ) in the above query? Does Cassandra process it in a way such that the question mark is replaced by some value? If I would like to update multiple columns of a

Which CQL version corresponds to which Cassandra version?

你离开我真会死。 提交于 2019-12-10 22:03:26
问题 The CQL documentation is organized according to the CQL version, not the Cassandra product version. Obviously, I want to read the CQL documentation corresponding to the Cassandra release I'm using, but I can't find comprehensive info on which CQL version corresponds to which Cassandra version: CQL 3.1 documentation is titled "CQL for Cassandra 2.0 & 2.1", but newer CQL docs no longer mention Cassandra versions The Product compatibility page only maps versions of OpsCenter, Cassandra and

cassandra: can you query against a collection field?

耗尽温柔 提交于 2019-12-10 21:12:25
问题 cassandra: can you query against a collection field? say if you wanted to keep a friends list in such a field, can you run a query along the lines of: where user_id = xxx and friend = 'bob'? If a collection is not right for this, What is the proper way to keep track of friends in cassandra? 回答1: Secondary indexes are still not yet supported but development is in progress (CASSANDRA-4511) In your model, if you know the user_id you could fetch the user and check if 'bob' is in their friends