bijukunjummen / golang-bigtable-sample

Demonstrates using bigtable with golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CRUD for Hotel

Install Bigtable Emulator

gcloud components install bigtable

Install cbt tool

gcloud components install cbt

Start emulator

gcloud beta emulators bigtable start --host-port=localhost:8086

Create a table and column family

In a different console:

export BIGTABLE_EMULATOR_HOST=localhost:8086
cbt -project "project-id" -instance "bus-instance" createtable hotels
cbt -project "project-id" -instance "bus-instance" createfamily hotels hotel_details

Check if table exists

cbt -project "project-id" -instance "bus-instance" ls
cbt -project "project-id" -instance "bus-instance" read hotels

Populate Data

export BIGTABLE_EMULATOR_HOST=localhost:8086
cd write
go run writeRecords.go

Ensure data shows up in the table

cbt -project "project-id" -instance "bus-instance" ls
cbt -project "project-id" -instance "bus-instance" read hotels

Read Records

export BIGTABLE_EMULATOR_HOST=localhost:8086
cd read
go run readRecords.go -zip or-01

About

Demonstrates using bigtable with golang

License:Apache License 2.0


Languages

Language:Go 100.0%