6

Is there any local server implementation for google BigQuery like localstack for AWS.

There is a reference to local server implementation for app engine with dev_appserver.py. I could run this with a dummy app.yaml.

  • I can not access interactive console using localhost:8000/console
  • Can I run bq command line utility after starting server using dev_appserver.py --enable-console app.yaml
Ambareesh B
  • 499
  • 1
  • 5
  • 14
  • I don't know any tool like that, in this [Medium Post](https://medium.com/clocal/week-1-high-level-architecture-best-practices-56322a886315) you can find a tool called [Emulation engine for GCP](https://medium.com/clocal/week-1-high-level-architecture-best-practices-56322a886315), but the framework doesn't include BigQuery. – Enrique Zetina Dec 02 '19 at 19:19

2 Answers2

5

While there is no emulator provided by Google, there is an open source BigQuery emulator available https://github.com/goccy/bigquery-emulator

I'm using this, and quite useful for local development and unit testing.

To run BQ emulator

$ docker pull ghcr.io/goccy/bigquery-emulator:latest --project=test-local
[bigquery-emulator] REST server listening at 0.0.0.0:9050
[bigquery-emulator] gRPC server listening at 0.0.0.0:9060

If you are using Go, you need to pass following options to new bq client

client, err := bigquery.NewClient(
    ctx,
    projectID,
    option.WithEndpoint("http://0.0.0.0:9050"),
    option.WithoutAuthentication(),
  )

BigQuery emulator utilizes SQLite for storage. You can select either memory or file as the data storage destination at startup, and if you set it to file, data can be persisted.

You can load seeds from a YAML file on startup

There is also an open ticket for Google to create emulator for BQ https://issuetracker.google.com/issues/129248927

pgollangi
  • 848
  • 3
  • 13
  • 28
3

There is no (Google-provided) emulator of BigQuery.

DazWilkin
  • 32,823
  • 5
  • 47
  • 88