Skip to main content

BigQuery query

Project description

BigQuery query - bqq

"Simplified, enriched bq query"

  • prompted queries (billed project, cost, size), using dry run
  • synchronize jobs from cloud (results linked with console.cloud.google.com)
  • super fast search through query job history
  • download and preview result data

Requirements

brew install fzf
brew install --cask google-cloud-sdk

Installation

pip install bqq

Usage

1. Initialize bqq

bqq --init

2. Set up default credentials

Underlying BigQuery client relies on application-default credentials

gcloud auth application-default login

Examples

Usage: bqq [OPTIONS] [SQL]

  BiqQuery query.

Options:
  -f, --file FILENAME  File containing SQL
  -y, --yes            Automatic yes to prompt
  -h, --history        Search local history
  -d, --delete         Delete job from history (local & cloud)
  -i, --info           Show gcloud configuration
  --clear              Clear local history
  --sync               Sync history from cloud
  --init               Initialize bqq environment
  --version            Show the version and exit.
  --help               Show this message and exit.

Query

bqq "SELECT repository.url, repository.created_at FROM bigquery-public-data.samples.github_nested LIMIT 100"
Billing project = my-google-project
Estimated size = 150.3 MiB
Estimated cost = +0.00 $
Do you want to continue? [y/N]: y

Query in file

bqq -f query.sql

Synchronize

bqq --sync
Syncing jobs information  [####################################]

Search history

bqq -h
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Creation time = 2020-01-01 00:00:00
Project = my-google-project
Account = account@google.com
Query cost = +0.00 $
Slot time =
Console link = https://console.cloud.google.com/bigquery?project=my-google-project&j=bq:US:3ff1f9b0-ae38-4d83-a711-7f28f74ff769&page=queryresults
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
SELECT repository.url, repository.created_at FROM bigquery-public-data.samples.github_nested LIMIT 100
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Download result ? [y/N]:
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ url                                                            ┃ created_at                ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
┃ https://github.com/liferay/liferay-plugins                     ┃ 2009/09/25 15:56:21 -0700 ┃
┃ https://github.com/plataformatec/simple_form                   ┃ 2009/12/28 06:23:48 -0800 ┃
┃ https://github.com/cakephp/datasources                         ┃ 2009/12/02 21:07:40 -0800 ┃
┃ https://github.com/ezsystems/ezfind                            ┃ 2010/10/19 13:46:09 -0700 ┃
┃ https://github.com/EightMedia/hammer.js                        ┃ 2012/03/02 04:58:28 -0800 ┃
┃ https://github.com/saasbook/hw3_rottenpotatoes                 ┃ 2012/02/03 10:33:06 -0800 ┃
┃ https://github.com/JetBrains/kotlin                            ┃ 2012/02/13 09:29:58 -0800 ┃
┃ https://github.com/php/php-src                                 ┃ 2011/06/15 18:52:25 -0700 ┃
┃ https://github.com/saasbook/hw4_rottenpotatoes                 ┃ 2012/02/17 13:23:02 -0800 ┃
┃ https://github.com/AFNetworking/AFNetworking                   ┃ 2011/05/31 14:28:44 -0700 ┃
┃ https://github.com/php/php-src                                 ┃ 2011/06/15 18:52:25 -0700 ┃
┃ https://github.com/mono/MonoGame                               ┃ 2011/04/06 17:23:40 -0700 ┃
...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bqq-0.2.2.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

bqq-0.2.2-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file bqq-0.2.2.tar.gz.

File metadata

  • Download URL: bqq-0.2.2.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for bqq-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e796458e005209e4c28f9d399461c6e3363090dca578fc4076580b14483535b8
MD5 9fac80d56cddcbedd61fceae65b6ea17
BLAKE2b-256 ea8dcdcd516ef7e3b4db0c08c9211c165011b8f9f1d38e9cb4f392f70612acb6

See more details on using hashes here.

File details

Details for the file bqq-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: bqq-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for bqq-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7f353b3b2905b13aa483df74c74d94384438e979b39bb756620b26bbfabcfda4
MD5 580ee33cb16d4e5821d399e745e6e7dd
BLAKE2b-256 5e852ca46a5869df3b44716af6aecb8da0d300e38ca3a27e05bf4f66990a7996

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page