php - UPDATE with Cassandra CQL -


i'm new cassandra , i'm trying update table using cql query:

update analytics set counter = ? hash = ?; 

i work in php using datastax php-driver, code statement this:

$statement = $session->prepare("update analytics set counter = ? hash = ?;"); $session->execute($statement, new cassandra\executionoptions(array('arguments' => array($count, $hash)))); 

the table:

create table if not exists analytics (domain varchar, page varchar, ip inet, attributes map <varchar, varchar>, hash varchar, counter int, date timestamp, primary key(hash, domain, date)); 

when execute statement error "missing mandatory primary key part domain" added clause allow filtering:

update analytics set counter = ? hash = ? allow filtering; 

but error, "line 1:48 missing eof @ 'allow'". what's wrong in these queries?

based on error have, guess created table compound primary key (hash, domain). in order update record in cassandra have provide whole key, i.e. both values, query should like:

update analytics set counter = counter+1 hash = ? , domain = ?

for more information check http://www.datastax.com/dev/blog/a-deep-look-to-the-cql-where-clause

it says: in update , delete statements primary key columns must restricted...


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -