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
6
votes
3 answers

Range query on secondary index in cassandra

I am using cassandra 2.1.10. So First I will clear that I know secondary index are anti-pattern in cassandra.But for testing purpose I was trying following: CREATE TABLE test_topology1.tt ( a text PRIMARY KEY, b timestamp ) WITH…
undefined_variable
  • 6,180
  • 2
  • 22
  • 37
6
votes
2 answers

SELECT contant value is Cassandra

I'm trying to do a simple select in Cassandra CQL3 containing a hardcoded value (constant) under a constant column name and I simply can't get it working Here's the query SELECT 1 as "id" Works fine in all kinds of DBMS I use but throws this error…
arkihillel
  • 322
  • 3
  • 13
6
votes
2 answers

Cassandra can not delete role or user which in the role or user list

create ROLE testROLE with PASSWORD = 'test'; create ROLE testROLE with PASSWORD = 'test'; list ROLES shows the roles successfully. DROP ROLE testROLE; InvalidRequest: code=2200 [Invalid query] message="testrole doesn't exist" DROP ROLE…
Zhang LongQI
  • 494
  • 1
  • 11
  • 25
6
votes
2 answers

How to delete a record in Cassandra?

I have a table like this: CREATE TABLE mytable ( user_id int, device_id ascii, record_time timestamp, timestamp timeuuid, info_1 text, info_2 int, PRIMARY KEY (user_id, device_id, record_time, timestamp) ); When I ask…
m.hashemian
  • 1,786
  • 2
  • 15
  • 31
6
votes
1 answer

Cassandra IN clause on index

Assume a simple table with one insert (or without this insert, doesn't really matter). CREATE TABLE test ( x int, y int, z int, PRIMARY KEY (x, y, z) ); create index z_index on test (z); insert into test(x, y, z) values (1,2,3); I struggle…
CatInABox
  • 387
  • 2
  • 4
  • 12
6
votes
1 answer

Astyanax Cassandra Double type precision

I'm trying to get a Double value from a Cassandra table with a double type column. I've created the table in CQL3 syntax: CREATE TABLE data_double ( datetime timestamp, value double, primary key (datetime) ); I've inserted a…
Guy Wald
  • 599
  • 1
  • 10
  • 25
6
votes
2 answers

Drop all keyspaces in cassandra

How to drop all keyspace in cassandra, I have requirement where I have to delete all keyspaces created by some test scripts. Thanks
Rahul Rohilla
  • 105
  • 1
  • 2
  • 8
6
votes
1 answer

Clustering Order using timeuuid CQL

My Usecase I want to order by timestamp DESC for the results. But I don't want timestamp to be the second column in the primary key as that will take of my querying capability for example create table demo(oid int,cid int,ts timeuuid,PRIMARY KEY…
Shrikar
  • 840
  • 1
  • 8
  • 30
6
votes
2 answers

How to create complex structure in Cassandra with CQL3

I have problem with presenting complex data structure in cassandra. JSON example of data : { "A": { "A_ID" : "1111" "field1": "value1", "field2": "value2", "field3": [ { "id": "id1", "name": "name1", …
Sergey Mikitko
  • 103
  • 2
  • 8
6
votes
4 answers

Using Cassandra and CQL3, how do you insert an entire wide row in a single request?

I want to insert a single row with 50,000 columns into Cassandra 1.2.8. Before inserting, I have all the data for the entire row ready to go (in memory): +---------+------+------+------+------+-------+ | | 0 | 1 | 2 | ... | 49999…
Les Hazlewood
  • 18,480
  • 13
  • 68
  • 76
6
votes
1 answer

Cassandra: Design Data Model for User, Roles and Permissions

I have a requirement of designing Data Model in cassandra for User, Role, Organization and permissions. Each Organization can have Users and Roles Each User can belong to number of Roles Each Role can have number of Users and Permissions. So,…
Dawood
  • 301
  • 1
  • 5
  • 12
6
votes
3 answers

Is it possible to use a cassandra table as a basic queue

Is it possible to use a table in cassandra as a queue, I don't think the strategy I use in mysql works, ie given this table: create table message_queue(id integer, message varchar(4000), retries int, sending boolean); We have a transaction that…
Jay
  • 19,649
  • 38
  • 121
  • 184
6
votes
2 answers

How to store an image as a Bytes field in cassandra database using cql engine?

I want to store my website images in cassandra database! I must read and store bytes of image. Do you have a nice code for me? I'm using python2.7, django framework and cql-engine! This is my code: 1- My Model: from cqlengine import columns from…
Omid Ebrahimi
  • 1,150
  • 2
  • 20
  • 38
5
votes
1 answer

Cassandra CQL support for CONTAINS negation

Cassandra supports CONTAINS on collections: CREATE TABLE contacts ( id int PRIMARY KEY, firstName text, lastName text, phones map, emails set ); CREATE INDEX ON contacts (firstName); CREATE INDEX ON contacts…
Omid
  • 1,959
  • 25
  • 42
5
votes
1 answer

how to do arithmetics with datetimes in CQL

My objective, is to remove a fixed amount of time, from now(). So I always get the last five minutes, or the last five hours. How can I achieve it ? The documentation on cassandra says: A duration can be added (+) or substracted (-) from a…
Micka
  • 1,648
  • 1
  • 19
  • 34