Questions tagged [cql]

CQL (Cassandra Query Language) is used to interact with and query Cassandra tables. Its syntax is similar to SQL, helping to lower the learning curve to working with Cassandra. For the Cypher graph query language, use the cypher tag.

CQL (Cassandra Query Language) is used to interact with and query Cassandra tables. Its syntax is similar to SQL, helping to lower the learning curve to working with Cassandra. Despite their similarities, in many cases CQL behaves very differently from SQL, so it is important to read the documentation before going too far.

Some of the more useful links to documentation on CQL:

2118 questions
16
votes
3 answers

SELECT Specific Value from map

I am trying to create a WIDE Column Table, 20,000+ columns Initially I was thinking I would use: CREATE TABLE details ( key TEXT, detail map PRIMARY KEY (KEY) ); Inserting into this table works fine UPDATE details SET detail…
e90jimmy
  • 272
  • 1
  • 2
  • 11
16
votes
2 answers

Advantages of using cql over thrift

Are there any distinct advantages for using cql over thrift or is it simply a case of developers being too used to SQL? I'm wanting to switch from thrift querying to cql, the only problem is I'm not sure about the downsides of doing so. What are…
Daniel Tomey
  • 163
  • 1
  • 1
  • 5
16
votes
1 answer

What causes "no viable alternative at input 'None'" error with Cassandra CQL

I'm attempting to insert a modified document back to Cassandra DB with a new key. I'm having hard time figuring out what is the issue the error message is pointing at. When looking for others that have had similar problems the answers seem to be…
Fuu
  • 3,424
  • 4
  • 33
  • 49
16
votes
2 answers

Insert to cassandra from python using cql

I'm planning to insert data to bellow CF that has compound keys. CREATE TABLE event_attend ( event_id int, event_type varchar, event_user_id int, PRIMARY KEY (event_id, event_type) #compound keys... ); But I can't insert data to…
tuelabel
  • 173
  • 1
  • 1
  • 4
15
votes
2 answers

cassandra - only superuser is allowed to perform CREATE USER queries

I'm logging in with on Ubuntu 14.10 on Cassandra 2.0.8 with Java 1.7.0_60-b19 cqlsh -u cassandra -p cassandra I'm running: CREATE USER a WITH PASSWORD 'a' NOSUPERUSER; I'm getting the error: Bad Request: Only superusers are allowed to perform…
hawkeye
  • 34,745
  • 30
  • 150
  • 304
15
votes
2 answers

Cassandra Schema for a Chat Application

I have gone though this article and here is the schema I have got from it. This is helpful for my application for maintaining statuses of a user, but how can I extend this to maintain one to one chat archive and relations between users, relations…
Exception
  • 8,111
  • 22
  • 85
  • 136
15
votes
2 answers

Comparing Cassandra's CQL vs Spark/Shark queries vs Hive/Hadoop (DSE version)

I would like to hear your thoughts and experiences on the usage of CQL and in-memory query engine Spark/Shark. From what I know, CQL processor is running inside Cassandra JVM on each node. Shark/Spark query processor attached with a Cassandra…
Minh Do
  • 329
  • 3
  • 7
14
votes
1 answer

how UPDATE rows in cassandra using only Partition Key?

My table looks like this create table Notes( user_id varchar, real_time timestamp, insertion_time timeuuid, read boolean PRIMARY KEY (user_id,real_time,insertion_time) ); create index read_index on Notes (read); I want update all…
mehnaazm
  • 287
  • 1
  • 4
  • 14
14
votes
2 answers

Querying Cassandra by a partial partition key

In Cassandra, I can create a composite partition key, separate from my clustering key: CREATE TABLE footable ( column1 text, column2 text, column3 text, column4 text, PRIMARY KEY ((column1, column2)) ) As I understand it,…
Mark
  • 11,257
  • 11
  • 61
  • 97
14
votes
1 answer

How to get tombstone count for a cql query?

I am trying to evaluate number of tombstones getting created in one of tables in our application. For that I am trying to use nodetool cfstats. Here is how I am doing it: create table demo.test(a int, b int, c int, primary key (a)); insert into…
Prasanth
  • 1,005
  • 5
  • 19
  • 39
14
votes
2 answers

Is the IN relation in Cassandra bad for queries?

Given an example of the following select in CQL: SELECT * FROM tickets WHERE ID IN (1,2,3,4) Given ID is a partition key, is using IN relation better than doing multiple queries or is there no difference?
Andy Leung
  • 352
  • 2
  • 4
  • 11
14
votes
2 answers

SELECT DISTINCT cql ignores WHERE clause

Executing two identical requests but the DISTINCT keyword gives unexpected results. Without the keyword, the result is ok but with DISTINCT, it looks like the where clause is ignored. Why ? Cqlsh version: Connected to Test Cluster at…
Diplow
  • 143
  • 1
  • 1
  • 5
14
votes
2 answers

how to construct range query in cassandra?

CREATE TABLE users ( userID uuid, firstname text, lastname text, state text, zip int, age int, PRIMARY KEY (userID) ); I want to construct the following queries: select * from users where age between 30 and 40 select * from users where state…
brain storm
  • 30,124
  • 69
  • 225
  • 393
14
votes
7 answers

Aggregation queries in Cassandra CQL

We are currently evaluating Cassandra as the data store for an analytical application. The plan was to dump raw data in Cassandra and then run mainly aggregation queries over it. Looking at CQL, it does not seem to support some traditional SQL…
samantp
  • 499
  • 1
  • 5
  • 11
14
votes
2 answers

Is there a way to discover Cassandra CQL table structure?

Let's say I use CQL to define this table. CREATE TABLE songs ( id uuid PRIMARY KEY, title text, album text, artist text, tags set, data blob); How can other developers (or myself after a few weeks) (re)discover the…
Vinnie
  • 12,400
  • 15
  • 59
  • 80