프리픽스를 사용해 행 삭제

지정된 프리픽스와 일치하는 row key를 사용해 행을 삭제합니다.

코드 샘플

C++

Bigtable용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Bigtable 클라이언트 라이브러리를 참조하세요.

Bigtable에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

namespace cbt = ::google::cloud::bigtable;
namespace cbta = ::google::cloud::bigtable_admin;
using ::google::cloud::Status;
[](cbta::BigtableTableAdminClient admin, std::string const& project_id,
   std::string const& instance_id, std::string const& table_id,
   std::string const& prefix) {
  std::string table_name = cbt::TableName(project_id, instance_id, table_id);

  google::bigtable::admin::v2::DropRowRangeRequest r;
  r.set_name(table_name);
  r.set_row_key_prefix(prefix);

  Status status = admin.DropRowRange(std::move(r));
  if (!status.ok()) throw std::runtime_error(status.message());
  std::cout << "All rows starting with " << prefix
            << " successfully deleted\n";
}

다음 단계

다른 Google Cloud 제품의 코드 샘플을 검색하고 필터링하려면 Google Cloud 샘플 브라우저를 참조하세요.