This is a simple application that demonstrates using the Google Cloud Client Library to connect to and interact with Cloud Bigtable.
Follow the instructions in the user documentation to create a Google Cloud Platform project and Cloud Bigtable cluster if necessary. You'll need to reference your project ID, zone and cluster ID to run the application.
First, set your Google Application Default Credentials
Install the dependencies with pip.
$ pip install -r requirements.txt
Run the application. Replace the command-line parameters with values for your cluster.
$ python main.py my-project my-cluster us-central1-c
You will see output resembling the following:
Create table Hello-Bigtable-1234
Write some greetings to the table
Scan for all greetings:
greeting0: Hello World!
greeting1: Hello Cloud Bigtable!
greeting2: Hello HappyBase!
Delete table Hello-Bigtable-1234
The application uses the Google Cloud Bigtable HappyBase package, an implementation of the HappyBase library, to make calls to Cloud Bigtable. It demonstrates several basic concepts of working with Cloud Bigtable via this API:
- Creating a Connection to a Cloud Bigtable Cluster.
- Using the Connection interface to create, disable and delete a Table.
- Using the Connection to get a Table.
- Using the Table to write rows via a put and scan across multiple rows using scan.