Skip to content

Latest commit

 

History

History
 
 

README.md

Python Samples for Cloud Bigtable

This directory contains samples for Cloud Bigtable, which may be used as a refererence for how to use Cloud Bigtable. Samples, quickstarts, and other documentation are available at cloud.google.com.

hello

A 'Hello World' demonstration using Cloud Bigtable.

Open in Cloud Shell

To run this sample:

  1. If this is your first time working with GCP products, you will need to set up the Cloud SDK or utilize Google Cloud Shell. This sample may require authetication and you will need to enable billing.

  2. Make a fork of this repo and clone the branch locally, then navigate to the sample directory you want to use.

  3. Install the dependencies needed to run the samples.

     pip install -r requirements.txt
    
  4. Run the sample using

     python main.py
    

hello_happybase

A 'Hello World' demonstration using Cloud Bigtable. This sample demonstrates using the Google Cloud Client Library HappyBase package, an implementation of the HappyBase API to connect to and interact with Cloud Bigtable.

Open in Cloud Shell

To run this sample:

  1. If this is your first time working with GCP products, you will need to set up the Cloud SDK or utilize Google Cloud Shell. This sample may require authetication and you will need to enable billing.

  2. Make a fork of this repo and clone the branch locally, then navigate to the sample directory you want to use.

  3. Install the dependencies needed to run the samples.

     pip install -r requirements.txt
    
  4. Run the sample using

     python main.py
    

instanceadmin

This page explains how to use the cbt command to connect to a Cloud Bigtable instance, perform basic administrative tasks, and read and write data in a table.

Open in Cloud Shell

To run this sample:

  1. If this is your first time working with GCP products, you will need to set up the Cloud SDK or utilize Google Cloud Shell. This sample may require authetication and you will need to enable billing.

  2. Make a fork of this repo and clone the branch locally, then navigate to the sample directory you want to use.

  3. Install the dependencies needed to run the samples.

     pip install -r requirements.txt
    
  4. Run the sample using

     python instanceadmin.py
    

Demonstrates how to connect to Cloud Bigtable and run some basic operations to create instance, create cluster, delete instance and delete cluster.

metricscaler

This sample demonstrates how to use Stackdriver Monitoring to scale Cloud Bigtable based on CPU usage.

Open in Cloud Shell

To run this sample:

  1. If this is your first time working with GCP products, you will need to set up the Cloud SDK or utilize Google Cloud Shell. This sample may require authetication and you will need to enable billing.

  2. Make a fork of this repo and clone the branch locally, then navigate to the sample directory you want to use.

  3. Install the dependencies needed to run the samples.

     pip install -r requirements.txt
    
  4. Run the sample using

     python metricscaler.py
    

Scales Cloud Bigtable clusters based on CPU usage.

quickstart

The Cloud Bigtable quickstart.

quickstart_happybase

The Cloud Bigtable quickstart using Happybase API.

snippets

Snippets for Cloud Bigtable.

tableadmin

Demonstrates how to connect to Cloud Bigtable and run some basic operations.

Open in Cloud Shell

To run this sample:

  1. If this is your first time working with GCP products, you will need to set up the Cloud SDK or utilize Google Cloud Shell. This sample may require authetication and you will need to enable billing.

  2. Make a fork of this repo and clone the branch locally, then navigate to the sample directory you want to use.

  3. Install the dependencies needed to run the samples.

     pip install -r requirements.txt
    
  4. Run the sample using

     python tableadmin.py
    

Remember to create a Cloud Bigtable cluster and set your Google Application Default Credentials before running this sample.

Additional Information

These samples use the Google Cloud Client Library for Python. You can read the documentation for more details on API usage and use GitHub to browse the source and report issues.

Contributing

For contributing guidelines, the Python style guide, and more information on prerequisite steps to contribute, view the source code at googleapis/python-bigtable.