cql

Most efficient way to query cassandra in small time-based chunks

大城市里の小女人 提交于 2019-12-12 04:25:25
问题 My Cassandra-based application needs to read the rows changed since last read. For this purpose, we are planning to have a table changed_rows that will contain two columns - ID - The ID of the changed row and Updated_Time - The timestamp when it was changed. What is the best way to read such a table such that it reads small group of rows ordered by time. Example: if the table is: ID Updated_Time foo 1000 bar 1200 abc 2000 pqr 2500 zyx 2900 ... xyz 901000 ... I have shown IDs to be simple 3

Datastax Cassandra odbc driver and starting cql2 on cqlsh 3 gives error as cqlsh: error: no such option: -2

别等时光非礼了梦想. 提交于 2019-12-12 02:15:50
问题 I have installed datastax ODBC driver for cassndra and also i have created keyspace and some tables using cql 3. But ODBC driver is not showing up those tables. Also in odbc documentation i read that the driver does not currently support version 3.0 of the Cassandra Query Language (CQL3) and the driver will not recognize keyspaces and column families that are defined with CQL 3. So in order to use cql 2 i am using following command which is suggested in driver documentation: ...\cqlsh” -2 But

Cassandra: selecting first entry for each value of an indexed column

安稳与你 提交于 2019-12-12 01:53:15
问题 I have a table of events and would like to extract the first timestamp (column unixtime ) for each user. Is there a way to do this with a single Cassandra query? The schema is the following: CREATE TABLE events ( id VARCHAR, unixtime bigint, u bigint, type VARCHAR, payload map<text, text>, PRIMARY KEY(id) ); CREATE INDEX events_u ON events (u); CREATE INDEX events_unixtime ON events (unixtime); CREATE INDEX events_type ON events (type); 回答1: According to your schema, each user will have a

Order by AND LIKE in Same Cassandra Query

我们两清 提交于 2019-12-11 23:43:58
问题 I want to execute this query on a cassandra table: select query,score,term from mytable where term like '%bottle%' order by score desc limit 10; The only columns of the table are query, score, term. I create the table as follows: CREATE TABLE mytable( "term" TEXT, "query" TEXT, "score" double, PRIMARY KEY ("term","score")) WITH CLUSTERING ORDER BY (score desc); I also have an index: This gives all sort of crazy errors. The first is: InvalidRequest: code=2200 [Invalid query] message="LIKE

Syntax error in CQL query] message="line 1:7 no viable alternative at input 'MATERIALIZED' ([CREATE] MATERIALIZED

社会主义新天地 提交于 2019-12-11 18:31:22
问题 Any clue why I am getting the error from the topic. Bellow I pasted all steps to reproduce the error. I found someone facing same issue and I try the solution proposed but I did get extactly the same issue. I tried follow Materialised view error in Cassandra by creating table all_orders and following @halfer solution but I reached exactly same error message. Whole Logs: C:\Program Files\DataStax Community\apache-cassandra\bin>set JAVA_HOME=C:\Program Files\Java\jre1.8.0_171 C:\Program Files

Materialised view error in Cassandra

徘徊边缘 提交于 2019-12-11 14:52:31
问题 I am new to Cassandra, I am trying to create a table and materialized view. but it not working. My queries are: -- all_orders create table all_orders ( id uuid, order_number bigint, country text, store_number bigint, supplier_number bigint, flow_type int, planned_delivery_date timestamp, locked boolean, primary key ( order_number,store_number,supplier_number,planned_delivery_date )); -- orders_by_date CREATE MATERIALIZED VIEW orders_by_date AS SELECT id, order_number, country, store_number,

No rows inserted in table when import from CSV in Cassandra

老子叫甜甜 提交于 2019-12-11 13:47:41
问题 I am trying to import a CSV file to a Cassandra table however I am facing a problem. When inserted successfully, at least this is what Cassandra tells, I still can't see any record. Here is a little more details : qlsh:recommendation_engine> COPY row_historical_game_outcome_data FROM '/home/adelin/workspace/docs/re_raw_data2.csv' WITH DELIMITER='|'; 2 rows imported in 0.216 seconds. cqlsh:recommendation_engine> select * from row_historical_game_outcome_data; customer_id | game_id | time |

Does cql support python 3?

断了今生、忘了曾经 提交于 2019-12-11 13:12:43
问题 Does cql has support python3? I tried to install with pip but it failed. rabit@localhost:/usr/bin> pip-3.3 install cql ^CDownloading/unpacking cql Operation cancelled by user Storing complete log in /home/rabit/.pip/pip.log rabit@localhost:/usr/bin> sudo pip-3.3 install cql root's password: Downloading/unpacking cql Downloading cql-1.4.0.tar.gz (76kB): 76kB downloaded Running setup.py egg_info for package cql Downloading/unpacking thrift (from cql) Running setup.py egg_info for package thrift

Cassandra 3.11.4 CQL GROUP BY Not working

喜夏-厌秋 提交于 2019-12-11 12:44:41
问题 I might be missing something very basic, or there is something very wrong; I am using Apache Cassandra 3.11.4 . Version details are as follows: Connected to Test Cluster at 127.0.0.1:9042. [cqlsh 5.0.1 | Cassandra 3.7.0 | CQL spec 3.4.2 | Native protocol v4] I have the following table and I want to get the count of individual citizen-ship status. CREATE TABLE population.residents ( residentId bigint, name varchar, office varchar, dob date, citizen text, PRIMARY KEY((residentId), dob) );

Cassandra materialized view shows stale data

≡放荡痞女 提交于 2019-12-11 12:19:13
问题 I was trying out the Cassandra 3.0 alpha to see how materialized views work and following the example shown here. The example works when a whole partition is deleted from the base table, but when I delete an individual clustered row, it continues to appear in the materialized view. Shouldn't a row deleted in the base table also disappear from the views? For example: CREATE TABLE base (part int, clus int , val int, PRIMARY KEY (part, clus)); CREATE MATERIALIZED VIEW view1 AS SELECT part FROM