Giter Club home page Giter Club logo

bigtable-emulator's Introduction

Bigtable emulator Docker image

This repository contains the Google Cloud Bigtable emulator, which is an in memory Go implementation of Bigtable allowing to create integration tests and a local development environment. Warning: this is not a production tool.

The emulator is offered in the Google Cloud SDK. However, it might be difficult or overkill to install the SDK on every development and CI box. In those situations, this image provides a lightweight alternative (< 17MB). It also provides an easy way to setup necessary tables and column families at startup.

Using it

To start it, run the following command:

docker run -d -p 9035:9035 shopify/bigtable-emulator

You can specify the tables and column families you need using the -cf switch. The format is a comma separated list of <instance>.<table>.<column family>. Ex:

docker run -d -p 9035:9035 shopify/bigtable-emulator -cf dev.records.data,dev.records.metadata

Connecting to it

You have to set the BIGTABLE_EMULATOR_HOST environment variable to the right docker host and container port (localhost:9035 in most cases). Then:

import (
  "cloud.google.com/go/bigtable"
  "golang.org/x/net/context"
  "golang.org/x/oauth2"
  "google.golang.org/api/option"
)

type devTokenSource struct{}

func (devTokenSource) Token() (*oauth2.Token, error) {
  return new(oauth2.Token), nil
}

func NewDevBigTableClient() (*bigtable.Client, error) {
  ctx := context.Background()
  project := "dev"
  instance := "dev"
  return bigtable.NewClient(
    ctx, 
    project, 
    instance,
    option.WithTokenSource(&devTokenSource{}),
  )
}

License

This software is available under the MIT license (see 'LICENSE' file for more details).

bigtable-emulator's People

Contributors

donk-shopify avatar jackmc avatar julienatshopify avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bigtable-emulator's Issues

Project and instance definition when using -cf

Hi, I would like to use your emulator in my local environment.
I tried to use -cf my_new_instance.my_new_table.my_new_column_family flag to create an instance, table and column family on container start.

I cannot see the created instance and table when I run cbt ls from my system (after having set BIGTABLE_EMULATOR_HST=localhost:9035).
I set .cbtrc like this :

instance = my_new_instance
project = my_project

Do you have an idea of why cbt does not find the newly created table / instance on the emulator.

Otherwise, when I run cbt createtable the table seems reachable from cbt because I can see it when running cbt ls afterwards.

Thanks for your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.