quickstart

command
v0.0.0-...-3b29460 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

README

Cloud Bigtable Quickstart in Go

This application demonstrates using the Google Cloud APIs Go Client Library to connect to a Cloud Bigtable instance and read a row from a table.

Before you begin

  1. Select or create a Cloud Platform project.

  2. Enable billing for your project.

  3. Enable the Cloud Bigtable API.

    Note: The quickstart performs an operation on an existing table (created below). If you require your code to create instances or tables, the Admin API must be enabled as well.

  4. Set up authentication with a service account so you can access the API from your local workstation.

  5. Follow the instructions in the user documentation to create a Cloud Bigtable instance (if necessary).

  6. Follow the cbt tutorial to install the cbt command line tool. Here are the cbt commands to create a table, column family and add some data:

   cbt createtable my-table
   cbt createfamily my-table cf1
   cbt set my-table r1 cf1:c1=test-value

Running the quickstart

The quickstart sample shows how to read rows from a table with the Bigtable client library.

Run the quickstart to read the row you just wrote using cbt:

   `go run main.go -project PROJECT_ID -instance INSTANCE_ID -table my-table

Expected output similar to:

2018/06/15 18:50:52 Getting a single row by row key:
2018/06/15 18:50:54 Row key: r1
2018/06/15 18:50:54 Data: test-value

Cleaning up

To avoid incurring extra charges to your Google Cloud Platform account, remove the resources created for this sample.

  1. Go to the Cloud Bigtable instance page in the Cloud Console.

  2. Click on the instance name.

  3. Click Delete instance.

    Delete

  4. Type the instance ID, then click Delete to delete the instance.

Documentation

Overview

Quickstart is a sample program demonstrating use of the Cloud Bigtable client library to read a row from an existing table.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL