Change data in cassandra with update command?

Is there a way to update the Cassandra database to update the table, as in MySQL? I have data stored in cassandra and I need to update the data. Is there an update team for this?

+3
source share
2 answers

Yes, you can execute UPDATE(from the CQL shell) to the database row. However, unlike MySQL, you can only specify the primary key in a sentence WHERE. This example uses a table called "products" with a primary key of "productNumber".

UPDATE products
SET description1='PROD DESC1'
WHERE productNumber='ITEM00123';

If the row for the specified primary key does not exist, a new one will be created.

. DataStax UPDATE CQL, abhi .

: Javascript, Cassandra (node-cassandra-client) Node.js. Cassandra Javascript. , UPDATE:

 var conOptions = { hosts: ['127.0.0.1:19170'],
                    keyspace: 'productKeyspace',
                    use_bigints: false };
 var con = new PooledConnection(conOptions);
 var cql = 'UPDATE products SET description1=? where productNumber=?';
 var params = ['PROD DESC1', 'ITEM00123'];
 con.execute(cql, params, function(err) {
   if (err) {
     console.log(err);
   }
   con.shutdown(callback);
 });

Rackspace doc node.js.

+1
0

All Articles