views:

79

answers:

1

Hi everybody,

In mysql, I can do the following query, UPDATE mytable SET price = '100' WHERE manufacturer='22'

Can this be done with cassandra?

Thanks!

+2  A: 

For that you will need to maintain your own index in a separate column family (you need a way to find all products (product ids) that are manufactured by a certatin manufacturer. When you have all the product ids doing a batch mutation is simple). E.g

 ManufacturerToProducts = { // this is a ColumnFamily
     '22': { // this is the key to this Row inside the CF
        // now we have an infinite # of columns in this row
       'prod_1': "prod_1",  //for simplicity I'm only showing the value (but in reality the values in the map are the entire Column.)
       'prod_1911' : null         
      },  // end row
      '23': {   // this is the key to another row in the CF
         // now we have another infinite # of columns in this row
        'prod_1492': null,
      },
    }

(disclaimer: thanks Arin for the annotation used above)

Schildmeijer
Hi! I really doesn't understand it yet after reading your link twice, but maybe after the fourth or fifth time :) Thanks for your help!
Industrial
I've updated my answer slightly. Any better?
Schildmeijer