1

I'm new to php and cassandra too. I was trying to make a batch delete operation in cassandra using phpcassa lib. There is a method available batch_insert() for inserting multiple rows in one call. Is there any similar method for removing multiple rows.

After searching at various sources over net I came up with below code for batch operation, But it is not working. I'm not sure whats going wrong.

    public function deleteDocuments(array $keys)
    {
    try {
         $batch = $this->document_column_family->batch();
         $docs = '';
        foreach ($keys as $key ) {
                  $batch->remove($key);
                }
            $batch->send();
            $this->document_column_family->remove($keys);
            print_r($docs);

            } catch (\cassandra\NotFoundException $e) {

            } catch (\Exception $e) {

            }
            return $docs;
    }
Jayant Narwani
  • 101
  • 1
  • 7

0 Answers0