Cassandra:更新多行?

时间:2010-08-14 20:57:49

标签: nosql cassandra

在mysql中,我可以执行以下查询UPDATE mytable SET price = '100' WHERE manufacturer='22'

这可以用cassandra完成吗?

谢谢!

1 个答案:

答案 0 :(得分:3)

为此,您需要在单独的列族中维护自己的索引(您需要一种方法来查找由certatin制造商生产的所有产品(产品ID)。当您让所有产品ID进行批量突变时很简单)。 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,
      },
    }

(免责声明:感谢Arin上面使用的注释)