키를 사용해 읽기

컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.

인접하지 않은 row key 집합을 사용하여 읽습니다.

코드 샘플

C++

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

namespace cbt = ::google::cloud::bigtable;
using ::google::cloud::StatusOr;
[](cbt::Table table, std::vector<std::string> const& row_keys) {
  auto row_set = cbt::RowSet();

  for (auto const& row_key : row_keys) {
    row_set.Append(row_key);
  }

  cbt::Filter filter = cbt::Filter::Latest(1);
  for (StatusOr<cbt::Row>& row : table.ReadRows(std::move(row_set), filter)) {
    if (!row) throw std::move(row).status();
    std::cout << row->row_key() << ":\n";
    for (auto const& cell : row->cells()) {
      std::cout << "\t" << cell.family_name() << ":"
                << cell.column_qualifier() << "    @ "
                << cell.timestamp().count() << "us\n"
                << "\t\"" << cell.value() << '"' << "\n";
    }
  }
}

다음 단계

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