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

Non frozen collections and user defined types on Cassandra 2.1.8

I'm trying to run the following example from here CREATE TYPE address ( street text, city text, zip int ); CREATE TABLE user_profiles ( login text PRIMARY KEY, first_name text, last_name…
userNotFound
  • 347
  • 1
  • 4
  • 13
18
votes
2 answers

Prettifying results of cqlsh commands in Linux terminal

Is there any way to prettify the results of cql commands in the Linux terminal while using the cqlsh utility (cql version of Mongo .pretty())? It becomes quite difficult to read the results when the output is displayed normally, especially when…
booleanhunter
  • 5,780
  • 4
  • 16
  • 21
18
votes
2 answers

CQL3: How to retrieve the TTL when there is only a primary key?

I have a CQL table defined like this: CREATE table primary_key_only( row_key varchar, clustered_key varchar, primary key(row_key, clustered_key) ) Assuming I insert values like this: INSERT INTO primary_key_only (row_key, clustered_key)…
Peter
  • 6,354
  • 1
  • 31
  • 29
18
votes
4 answers

MAX(), DISTINCT and group by in Cassandra

I am trying to remodel a SQL database Cassandra such that, I can find the Cassandra equivalent for the SQL queries. I use CQL 3 and Cassandra v1.2. I modeled the db design in cassandra so that it supports the order by clauses and denormalized tables…
eldho
  • 255
  • 1
  • 2
  • 13
17
votes
3 answers

Create Cassandra table using cql3 with default TTL

Is it possible to create a table that has a default TTL for all rows that are inserted into it, or do you have to always remember to set the TTL when you do an insert/update? Cant see anything on this in the…
Ziklag
  • 251
  • 1
  • 2
  • 6
17
votes
3 answers

How do I set the consistency level of an individual CQL query in CQL3?

In the earlier beta releases of CQL, there was a command I could use to set the read / write consistency of an individual CQL operation. It looked like this: SELECT * FROM users WHERE state='TX' USING CONSISTENCY QUORUM; I use CQL3 regularly and…
Aaronontheweb
  • 8,224
  • 6
  • 32
  • 61
16
votes
2 answers

Where and Order By Clauses in Cassandra CQL

I am new to NoSQL database and have just started using apache Cassandra. I created a simple table "emp" with primary key on "empno" column. This is a simple table as we always get in Oracle's default scott schema. Now I loaded data using the COPY…
Amir S Siddiqui
  • 211
  • 1
  • 3
  • 4
16
votes
2 answers

Bad Request: No indexed columns present in by-columns clause with Equal operator : CQL error?

I have below table in CQL- create table test ( employee_id text, employee_name text, value text, last_modified_date timeuuid, primary key (employee_id) ); I inserted couple of records in the above table like this which I will…
AKIWEB
  • 19,008
  • 67
  • 180
  • 294
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
15
votes
3 answers

how to avoid secondary indexes in cassandra?

I have heard repeatedly that secondary indexes (in cassandra) is only for convenience but not for better performance. The only case where it is recommended to use secondary indexes when you have low cardinality (such as gender column which has two…
brain storm
  • 30,124
  • 69
  • 225
  • 393
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

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
13
votes
1 answer

Cassandra cql: how to select the LAST n rows from a table

I want to verify that rows are getting added to the table. What cql statement would show the last n rows from the table below? Table description below: cqlsh:timeseries> describe table option_data; CREATE TABLE option_data ( ts bigint, id…
Ivan
  • 7,448
  • 14
  • 69
  • 134
13
votes
4 answers

Cassandra Java Driver: How are insert, update, and delete results reported?

I am writing an application and I need to be able to tell if an inserts and updates succeed. I am using "INSERT ... IF NOT EXISTS" to get the light weight transaction behavior and noticed that the result set returned from execute, contains a row…
AlphaGeek
  • 383
  • 2
  • 11
13
votes
4 answers

Cassandra selective copy

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…
Dhamodaran
  • 313
  • 1
  • 3
  • 7
1
2
3
43 44