bqtools

command module
v0.0.0-...-2071987 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2016 License: BSD-3-Clause Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

BigQuery Tools

A tool to figure out what costs money in a Google BigQuery project. Try it at https://bigquery-tools.appspot-preview.com/ Send feedback to ej@evanjones.ca.

Deploying

  1. Get a BigQuery OAuth Client ID: https://console.cloud.google.com/apis/credentials . Add https://yourdomain.appspot-preview.com/oauth2callback as the OAuth2 callback URL. If you want to test this locally, you should also add localhost:8080.

  2. Generate a secure cookie hash key: openssl rand -hex 64 and encryption key: openssl rand -hex 32

  3. Save these values as constants in credentials.go:

package main

const googleOAuthClientID = "..."
const googleOAuthClientSecret = "..."

var cookieHashKey = mustDecodeHex("...")
var cookieEncryptionKey = mustDecodeHex("...")
  1. Create a Cloud SQL instance. Edit bqcost.go and bqcost.yaml to reference the correct name.

  2. Edit bqcost.go to reference the correct host name that will serve your app.

  3. Deploy: aedeploy gcloud app deploy --project=(PROJECT) bqcost.yaml

Running locally

You can run a local copy against cloud SQL with go run bqcost.go credentials.go --cloudSQLProxy=true

You can also run a local copy using SQLite, but I need to figure out a way to make this work without breaking deploys to App Engine Flexible.

Known Issues

  • Downloading the state of all the tables is incredibly slow. It needs to be parallelized.
  • The "get table data from BigQuery" job is just a goroutine. If the instance restarts, the job is stuck forever and you will never be able to access the project. This should be split into smaller chunks that get retried.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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