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

How to create foreign key in Cassandra CQL

I'm trying to replicate a SQL database in Cassandra, but, while I had no problem creating the tables, I found that I cannot find an example easy to understand that shows how I can create foreign keys in Cassandra. So, If I have this in SQL: CREATE…
Sascuash
  • 3,661
  • 10
  • 46
  • 65
12
votes
2 answers

Can I create a secondary index on multiple columns in cassandra

Can I create a secondary index on multiple columns in cassandra? like can I do create index my_composite_index on my_column_family (id,name) CQL throws error :2:Bad Request: line 1:73 mismatched input ',' expecting ')'
user1955409
  • 211
  • 1
  • 3
  • 6
12
votes
2 answers

Passing parameter to Cassandra CQL query using DataStax client

I am using datastax as a client for connecting to cassandra. I have successfully connected to cassandra cluster/keyspace/column families through Java. I am trying, firing some queries on cassandra column family thriugh java. For me it is working for…
Saurabh Deshpande
  • 1,153
  • 4
  • 18
  • 35
12
votes
3 answers

RPC timeout in cqlsh - Cassandra

I have 5 nodes in my ring with SimpleTopologyStrategy and replication_factor=3. I inserted 1M rows using stress tool . When am trying to read the row count in cqlsh using SELECT count(*) FROM Keyspace1.Standard1 limit 1000000; It fails with…
flowerpot
  • 519
  • 2
  • 7
  • 18
12
votes
2 answers

How to retrieve the timestamp from cassandra?

In the below cassandra, "get result"..we can able to retrieve the column name and values. But how to retrieve the timestamp..Is there any better idea to get the values by using timestamp [default@sample]get user[bob]; …
BobDroid
  • 1,898
  • 5
  • 19
  • 39
11
votes
1 answer

ScyllaDB - [Invalid query] message="Collection filtering is not supported yet"

I have a table with a column of type list and I would like to check if there is an item inside the list, using CONTAINS keyword. According to scylla documentation: The CONTAINS operator may only be used on collection columns (lists, sets, and…
Giorgos Ntymenos
  • 361
  • 2
  • 13
11
votes
3 answers

Datastax DevCenter freezes on startup

Just installed (copied over the app from the downloaded dmg) DevCenter 1.6 on my mac, running macOs Sierra 10.12.6 with jdk 8u152 installed. The application loads a UI (splash screen then a couple of checkboxes in a window for getting started) but…
0cd
  • 1,729
  • 3
  • 15
  • 24
11
votes
1 answer

Cassandra Wide Row/Dynamic Columns

I'm new to NoSQL; so, I'm trying to understand some of the Cassandra concepts that I can't really get from the dozens of sources that I have studied. Should I consider wide row, and dynamic columns as synonyms; or are they 2 different concepts? Am…
user1888243
  • 2,591
  • 9
  • 32
  • 44
11
votes
3 answers

CQL check if record exists

I'm on my path to learning Cassandra, and the differences in CQL and SQL, but I'm noticing the absence of a way to check to see if a record exists with Cassandra. Currently, the best way that I have is to use SELECT primary_keys FROM TABLE WHERE…
Jim Pedid
  • 2,730
  • 3
  • 23
  • 27
11
votes
1 answer

CQLSH: Converting unix timestamp to datetime

I am performing a cql query on a column that stores the values as unix timestmap, but want the results to output as datetime. Is there a way to do this? i.e. something like the following: select convertToDateTime(column) from table;
DevOtts
  • 125
  • 1
  • 2
  • 5
11
votes
2 answers

How to query a field in a user defined type in a set using CQL (Cassandra)

I am using the User Defined Types in CQL 3.1 (cqlsh info below): [cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native protocol v3] I have created the following user-defined type (simplified here for demonstration purposes): create type fullname…
John M
  • 111
  • 1
  • 1
  • 7
11
votes
1 answer

What is the maximum length of data passed to cassandra column

Is there any limit on maximum length we can specify for a column while creating Cassandra table, if yes, then how much we can specify? I am new to using Cassandra, please let me know
Rajesh Kumar
  • 1,270
  • 4
  • 15
  • 31
11
votes
2 answers

How to deploy changes to a Cassandra CQL schema

We have an application which is using Cassandra for its database. How should we deploy schema changes in a live production environment. In development we are just blowing the database away and recreating it with a 'database.cql' script kept in…
Phil
  • 2,239
  • 3
  • 25
  • 26
11
votes
1 answer

Alter cassandra column family primary key using cassandra-cli or CQL

I am using Cassandra 1.2.5. After creating a column family in Cassandra using cassandra-cli, is it possible to modify the primary key on the column family using either cassandra-cli or CQL? Specifically, I currently have the following table (from…
Justin Sweeney
  • 133
  • 1
  • 1
  • 7
11
votes
2 answers

CQL Cassandra OR operator

I'm trying to do something like this in CQL: SELECT address FROM Person WHERE age= 20 or age= 25 But Cassandra doesn't support the OR operator and I can't use IN(20, 25) either, because age isn't a primary key. Is there any way to solve this ?…
user2090879
  • 683
  • 2
  • 10
  • 16