Bigtable client libraries

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

This page shows how to get started with the Cloud Client Libraries for the Cloud Bigtable API. Read more about the client libraries for Cloud APIs in Client Libraries Explained.

Install the client library

C++

See the GitHub README for details about this client library's requirements and install dependencies.

C#

For more information, see Setting Up a C# Development Environment.

Install-Package Google.Cloud.Bigtable.V2 -Pre
Install-Package Google.Cloud.Bigtable.Admin.V2 -Pre

Go

For more information, see Setting Up a Go Development Environment.

go get cloud.google.com/go/bigtable

Java

For more information, see Setting Up a Java Development Environment.

If you are using Maven, add the following to your pom.xml file. For more information about BOMs, see The Google Cloud Platform Libraries BOM.

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>libraries-bom</artifactId>
      <version>26.1.5</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

<dependencies>
  <dependency>
    <groupId>com.google.cloud</groupId>
    <artifactId>google-cloud-bigtable</artifactId>
  </dependency>

If you are using Gradle, add the following to your dependencies:

implementation platform('com.google.cloud:libraries-bom:26.1.5')

implementation 'com.google.cloud:google-cloud-bigtable'

If you are using sbt, add the following to your dependencies:

libraryDependencies += "com.google.cloud" % "google-cloud-bigtable" % "2.16.0"

HBase

The Bigtable HBase client for Java includes the following Maven artifacts that you can use in your project. All of the artifacts are based on HBase 1.x:

The Bigtable Maven artifacts include the netty-tcnative-boringssl-static library, which requires that you use Linux, macOS, or Windows on an x86 64-bit processor.

If your application runs in the App Engine standard environment, you must use a current version of the Java runtime. The Java 7 runtime is deprecated and does not support the HBase client for Java.

The following examples assume that you are using the bigtable-hbase-1.x artifact.

If you are using Maven, add the following to your pom.xml file. For more information about BOMs, see The Google Cloud Platform Libraries BOM.

<dependency>
  <groupId>com.google.cloud.bigtable</groupId>
  <artifactId>bigtable-hbase-1.x</artifactId>
  <version>2.0.0</version>
</dependency>

If you are using Gradle, add the following to your dependencies:

compile 'com.google.cloud.bigtable:bigtable-hbase-1.x:2.0.0'

If you are using sbt, add the following to your dependencies:

libraryDependencies += "com.google.cloud.bigtable" % "bigtable-hbase-1.x" % "2.0.0"

Node.js

For more information, see Setting Up a Node.js Development Environment.

npm install --save @google-cloud/bigtable

PHP

For more information, see Using PHP on Google Cloud.

Install and enable the gRPC extension for PHP, then run the following command:
composer require google/cloud-bigtable

Python

For more information, see Setting Up a Python Development Environment.

pip install --upgrade google-cloud-bigtable

Ruby

For more information, see Setting Up a Ruby Development Environment.

gem install google-cloud-bigtable

Set up authentication

When you use client libraries, you use Application Default Credentials (ADC) to authenticate. For information about setting up ADC, see Provide credentials for Application Default Credentials. For information about using ADC with client libraries, see Authenticate using client libraries.

Use the client library

The following example shows how to use the client library. The example connects to a Bigtable instance and reads a row from a table.

If you haven't stored any data in Bigtable yet, you can use the cbt command-line tool to create a table and add some data. See the quickstart using cbt for instructions.

C++

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

#include "google/cloud/bigtable/table.h"

int main(int argc, char* argv[]) try {
  if (argc != 4) {
    std::string const cmd = argv[0];
    auto last_slash = std::string(cmd).find_last_of('/');
    std::cerr << "Usage: " << cmd.substr(last_slash + 1)
              << " <project_id> <instance_id> <table_id>\n";
    return 1;
  }

  std::string const project_id = argv[1];
  std::string const instance_id = argv[2];
  std::string const table_id = argv[3];

  // Create a namespace alias to make the code easier to read.
  namespace cbt = ::google::cloud::bigtable;

  cbt::Table table(cbt::MakeDataConnection(),
                   cbt::TableResource(project_id, instance_id, table_id));

  std::string row_key = "r1";
  std::string column_family = "cf1";

  std::cout << "Getting a single row by row key:" << std::flush;
  google::cloud::StatusOr<std::pair<bool, cbt::Row>> result =
      table.ReadRow(row_key, cbt::Filter::FamilyRegex(column_family));
  if (!result) throw std::move(result).status();
  if (!result->first) {
    std::cout << "Cannot find row " << row_key << " in the table: " << table_id