Questions tagged [cql3]

Cassandra Query Language (CQL) is a SQL (Structured Query Language)-like language for querying Cassandra.

Cassandra Query Language (CQL) is a SQL (Structured Query Language)-like language for querying Cassandra.

Although CQL has many similarities to SQL, there are some fundamental differences.

For example, the CQL adaptation to the Cassandra data model and architecture, doesn't support operations, such as JOINs, which make no sense in a non-relational database.

657 questions
9
votes
2 answers

CQL3 Each row to have its own schema

I want to use Cassandra in a .Net application. My objective is to store some data in a column family, but each row of data will have varying schema. Example (A very simple one) I want to have a 'Toys' column family to store the following objects,…
Padmika
  • 466
  • 6
  • 14
9
votes
1 answer

CQL: Bad Request: Missing CLUSTERING ORDER for column

What is the problem with this CQL query cqlsh> create table citybizz.notifications( ... userId varchar, ... notifId UUID, ... notification varchar, ... time bigint,read boolean, ... primary key (userId,…
Manish Kumar
  • 10,214
  • 25
  • 77
  • 147
9
votes
1 answer

how to perform "not in" filter in cql3 query select?

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'
jezuz
  • 413
  • 2
  • 5
  • 13
9
votes
3 answers

Timestamp comparison in cassandra

As shown in the picture querying with exact timestamp(2013-08-01 15:02:56) is not returning any result though a row with that timestamp exists but it returns results with that row when queried for timestamps > '2013-08-01 15:02:56' Is this normal…
9
votes
4 answers

Does CQL3 require a schema for Cassandra now?

I've just had a crash course of Cassandra over the last week and went from Thrift API to CQL to grokking SuperColumns to learning I shouldn't use them and user Composite Keys instead. I'm now trying out CQL3 and it would appear that I can no longer…
Arne Claassen
  • 14,088
  • 5
  • 67
  • 106
8
votes
2 answers

How do I retrieve table names in Cassandra using Java?

If is use this code in a CQL shell , I get all the names of table(s) in that keyspace. DESCRIBE TABLES; I want to retrieve the same data using ResulSet . Below is my code in Java. String query = "DESCRIBE TABLES;"; ResultSet rs =…
Kangkan Lahkar
  • 267
  • 5
  • 16
8
votes
2 answers

Understanding the Token Function in Cassandra

Hello I was reading the Cassandra documentation on Token Function, I am trying to achieve pagination for a Cassandra table, I am unable to understand the lines highlighted. The document speaks about the difference between k > 42 and TOKEN(k) >…
Sohail Khan
  • 279
  • 1
  • 3
  • 10
8
votes
2 answers

Finding distinct values of non Primary Key column in CQL Cassandra

I use the following code for creating table: CREATE KEYSPACE mykeyspace WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; USE mykeyspace; CREATE TABLE users ( user_id int PRIMARY KEY, fname text, lname text ); INSERT…
Avi
  • 2,247
  • 4
  • 30
  • 52
8
votes
1 answer

How to keep 2 Cassandra tables within same partition

I tried reading up on datastax blogs and documentation but could not find any specific on this Is there a way to keep 2 tables in Cassandra to belong to same partition? For example: CREATE TYPE addr ( street_address1 text, city text, state…
8
votes
2 answers

Is it possible to insert/write data without defining columns in Cassandra?

I am trying to understand the fundamentals of Cassandra data model. I am using CQL. As per I know the schema must be defined before anyone can insert into new columns. If someone needs to add any column can use ALTER TABLE and can INSERT value to…
Chaity
  • 1,348
  • 13
  • 20
8
votes
1 answer

Cassandra CQL searching for element in list

I have a table that has a column of list type (tags): CREATE TABLE "Videos" ( video_id UUID, title VARCHAR, tags LIST, PRIMARY KEY (video_id, upload_timestamp) ) WITH CLUSTERING ORDER BY (upload_timestamp DESC); I have…
kazy
  • 1,111
  • 2
  • 14
  • 24
8
votes
3 answers

what does `create index` do in cassandra tables?

consider this example: create table bite ( id varchar PRIMARY KEY, feedid varchar, score bigint, data varchar ); create index bite_feedid on bite (feedid); create index bite_score on bite (score); I am not sure what the…
eagertoLearn
  • 9,772
  • 23
  • 80
  • 122
8
votes
1 answer

Understanding Cassandra's storage overhead

I have been reading this section of the Cassandra docs and found the following a little puzzling: Determine column overhead: regular_total_column_size = column_name_size + column_value_size + 15 counter - expiring_total_column_size =…
Giovanni Botta
  • 9,626
  • 5
  • 51
  • 94
8
votes
1 answer

Select TTL for an element in a map in Cassandra

Is there any way to select TTL value for an element in a map in Cassandra with CQL3? I've tried this, but it doesn't work: SELECT TTL (mapname['element']) FROM columnfamily
MCs88
  • 81
  • 2
8
votes
1 answer

cql3 query with more than 1 EQ restriction and ORDER BY

using CF: CREATE TABLE history ( domain text, iid text, timeid timeuuid, data text, comments text, PRIMARY KEY (domain, iid, timeid) ); I'd like to query it like this: select domain, iid, timeid, data, comments from mappings where…