Delete rows with a prefix

Delete rows with row keys matching a given prefix.

Code sample


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

namespace cbt = ::google::cloud::bigtable;
[](cbt::TableAdmin admin, std::string const& table_id,
   std::string const& prefix) {
  google::cloud::Status status = admin.DropRowsByPrefix(table_id, prefix);
  if (!status.ok()) throw std::runtime_error(status.message());
  std::cout << "All rows starting with " << prefix
            << " successfully deleted\n";

What's next

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