cql

Unable to start cqlsh in Mac OS X?

情到浓时终转凉″ 提交于 2019-12-23 09:28:11
问题 I have installed cassandra 2.0 successfully. When I try to start cql 3 I get no such option: cassandra -v 2.0.9 ./cqlsh -3 Usage: cqlsh [options] [host [port]] cqlsh: error: no such option: -3 回答1: Once cassandra is starded (I guess in localhost with default settings) you can connect using ./cqlsh localhost if you want start it with a specific (older) version you can do ./cqlsh --cqlversion=X.Y.Z localhost; where X.Y.Z is the version (eg: 3.1.0) 来源: https://stackoverflow.com/questions

Is it possible to use variables in cql commands in cql scripts?

£可爱£侵袭症+ 提交于 2019-12-23 09:27:21
问题 Is there a way to pass variables in CQL commands when being used in CQL scripts like: select * from "Column Family Name" where "ColumnName"='A variable which takes different values'; Any suggestions are welcome. 回答1: No, CQL really doesn't have a way to define variables, run a loop, and update/query based on those variables. As an alternative, I typically use the DataStax Python driver for simple tasks/scripts like this. Here is an excerpt from a Python script I used a while back to populate

Cassandra CQL 3 - Prefix Select

青春壹個敷衍的年華 提交于 2019-12-23 02:59:08
问题 is there a way to perform a select based on a string prefix using CQL3? For example, consider the following table: Key | Value ------------ ABC | 0x01 ABD | 0x02 BBB | 0x03 I want to select all the keys with the prefix 'AB'. The database will be used to store spacial information, using a geohash approach. 回答1: That is not possible "out of the box"... However, there are some "tricks" people came up with, see these two posts: Cassandra (Pycassa/CQL) Return Partial Match Is there any query for

Cassandra NoHostAvailableException Java-CQLDriver

女生的网名这么多〃 提交于 2019-12-22 09:49:12
问题 I am building an application in java using Cassandra's CQL driver. I am able to run it properly when I use local cassandra server. However the same code when I try to run is not working for remote cassandra server. It gives the following error during initialization :- Following are the maven dependecy that I am using for CQL driver:- <dependency> <groupId>com.datastax.cassandra</groupId> <artifactId>cassandra-driver-core</artifactId> <version>2.1.3</version> </dependency> <dependency>

Cassandra: “Unable to complete the operation against any hosts” during session.execute()

♀尐吖头ヾ 提交于 2019-12-22 06:11:52
问题 Cassandra version: 1.2.2 Thrift API version: 19.35.0 CQL supported versions: 2.0.0,3.0.1 (default: 3.0.1) cassandra-driver for python 3.4 running cassandra/bin/cassandra with sudo Code sample : from cassandra.cluster import Cluster cluster = Cluster() session = cluster.connect() # 1 session.execute("use test") # 2 cluster.shutdown() Error message for # 2: session.execute("use test") File "cassandra/cluster.py", line 1581, in cassandra.cluster.Session.execute File "cassandra/cluster.py", line

Cassandra “default_time_to_live” property is not deleting data

倖福魔咒の 提交于 2019-12-22 06:00:15
问题 I've created a table like: CREATE TABLE IF NOT EXISTS metrics_second( timestamp timestamp, value counter, PRIMARY KEY ((timestamp)) ) WITH default_time_to_live=1; And inserted some data like: UPDATE metrics_second SET value = value + 1 WHERE timestamp = '2015-01-22 17:43:55-0800'; When executing SELECT * FROM metrics_second I always see the data, even after a minute or so, although the default_time_to_live property of the table is set to one second. Why is that? 回答1: As @RussS confirmed,

how to construct range query in cassandra?

故事扮演 提交于 2019-12-22 04:58:28
问题 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 in "AZ" AND "WA" I know I need two more tables to do this query but I dont know how the should be? EDIT From Carlo's comments, I see this is the only possibility CREATE TABLE users ( userID uuid, firstname text, lastname text, state text, zip int, age int

Error: unable to connect to cassandra server. Unconfigured table

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 03:26:07
问题 I am trying to connect to cassandra, which is running on local desktop, via cassandra-driver for python using this simple code. from cassandra.cluster import Cluster cluster = Cluster() session = cluster.connect() and getting this error: NoHostAvailable: ('Unable to connect to any servers', {'127.0.0.1': InvalidRequest(u'code=2200 [Invalid query] message="unconfigured table schema_keyspaces"',)}) From the logs of cassandra, I see how it does establish connection, but it gets this errors:

High number of tombstones with TTL columns in Cassandra

眉间皱痕 提交于 2019-12-22 01:29:17
问题 I have a cassandra Column Family, or CQL table with the following schema: CREATE TABLE user_actions ( company_id varchar, employee_id varchar, inserted_at timeuuid, action_type varchar, PRIMARY KEY ((company_id, employee_id), inserted_at) ) WITH CLUSTERING ORDER BY (inserted_at DESC); Basically a composite partition key that is made up of a company ID and an employee ID, and a clustering column, representing the insertion time, that is used to order the columns in reverse chronological order

Spark Cassandra connector filtering with IN clause

北战南征 提交于 2019-12-21 20:47:54
问题 I am facing some issues with spark cassandra connector filtering for java. Cassandra allows the filtering by last column of the partition key with IN clause. e.g create table cf_text (a varchar,b varchar,c varchar, primary key((a,b),c)) Query : select * from cf_text where a ='asdf' and b in ('af','sd'); sc.cassandraTable("test", "cf_text").where("a = ?", "af").toArray.foreach(println) How count I specify the IN clause which is used in the CQL query in spark? How range queries can be specified