Delete columns with mutate

Stay organized with collections Save and categorize content based on your preferences.

Delete columns within a row using mutate.

Code sample


To learn how to install and use the client library for Bigtable, see Bigtable client libraries.

namespace cbt = ::google::cloud::bigtable;
[](cbt::Table table, std::string const& key,
   std::vector<std::pair<std::string, std::string>> const& columns) {
  cbt::SingleRowMutation mutation(key);
  for (auto const& c : columns) {
    mutation.emplace_back(cbt::DeleteFromColumn(c.first, c.second));
  google::cloud::Status status = table.Apply(std::move(mutation));
  if (!status.ok()) throw std::runtime_error(status.message());
  std::cout << "Columns successfully deleted from row\n";

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.