All Projects → yoheimuta → dbq

yoheimuta / dbq

Licence: MIT License
CLI tool to easily Decorate BigQuery table name

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to dbq

sparkbq
Sparklyr extension package to connect to Google BigQuery
Stars: ✭ 16 (+23.08%)
Mutual labels:  bigquery
etlflow
EtlFlow is an ecosystem of functional libraries in Scala based on ZIO for writing various different tasks, jobs on GCP and AWS.
Stars: ✭ 38 (+192.31%)
Mutual labels:  bigquery
bqv
The simplest tool to manage views of BigQuery.
Stars: ✭ 22 (+69.23%)
Mutual labels:  bigquery
google-cloud
A collection of Google Cloud Platform (GCP) plugins
Stars: ✭ 34 (+161.54%)
Mutual labels:  bigquery
bigquery-kafka-connect
☁️ nodejs kafka connect connector for Google BigQuery
Stars: ✭ 17 (+30.77%)
Mutual labels:  bigquery
go-bqloader
bqloader is a simple ETL framework to load data from Cloud Storage into BigQuery.
Stars: ✭ 16 (+23.08%)
Mutual labels:  bigquery
starlake
Starlake is a Spark Based On Premise and Cloud ELT/ETL Framework for Batch & Stream Processing
Stars: ✭ 16 (+23.08%)
Mutual labels:  bigquery
gcp-ml
Google Cloud Platform Machine Learning Samples
Stars: ✭ 31 (+138.46%)
Mutual labels:  bigquery
bigquery-to-datastore
Export a whole BigQuery table to Google Datastore with Apache Beam/Google Dataflow
Stars: ✭ 56 (+330.77%)
Mutual labels:  bigquery
team-timesheets
Time tracking web app built as a replacement for old school timesheets.
Stars: ✭ 25 (+92.31%)
Mutual labels:  bigquery
pgsink
Logically replicate data out of Postgres into sinks (files, Google BigQuery, etc)
Stars: ✭ 53 (+307.69%)
Mutual labels:  bigquery
iris3
An upgraded and improved version of the Iris automatic GCP-labeling project
Stars: ✭ 38 (+192.31%)
Mutual labels:  bigquery
dbt-ml-preprocessing
A SQL port of python's scikit-learn preprocessing module, provided as cross-database dbt macros.
Stars: ✭ 128 (+884.62%)
Mutual labels:  bigquery
becquerel
Gateway server that provides an OData interface to BigQuery and Elasticsearch
Stars: ✭ 17 (+30.77%)
Mutual labels:  bigquery
astro
Astro allows rapid and clean development of {Extract, Load, Transform} workflows using Python and SQL, powered by Apache Airflow.
Stars: ✭ 79 (+507.69%)
Mutual labels:  bigquery
DataflowTemplates
Convenient Dataflow pipelines for transforming data between cloud data sources
Stars: ✭ 22 (+69.23%)
Mutual labels:  bigquery
argon
Campaign Manager 360 and Display & Video 360 Reports to BigQuery connector
Stars: ✭ 31 (+138.46%)
Mutual labels:  bigquery
target-and-market
A data-driven tool to identify the best candidates for a marketing campaign and optimize it.
Stars: ✭ 19 (+46.15%)
Mutual labels:  bigquery
airflow-tutorial
Use Airflow to move data from multiple MySQL databases to BigQuery
Stars: ✭ 96 (+638.46%)
Mutual labels:  bigquery
kuromoji-for-bigquery
Tokenize Japanese text on BigQuery with Kuromoji in Apache Beam/Google Dataflow at scale
Stars: ✭ 11 (-15.38%)
Mutual labels:  bigquery

dbq

GitHub release Wercker MIT License

CLI tool to easily Decorate BigQuery table name

Description

dbq enables you to use Table Range Decorators to perform a more cost-effective query to BigQuery without complex calculation.

  • dbq supports both Relative value and Absolute value
  • dbq also supports timezone calculation.

dbq will cut down on considerable data processed and spending :bowtie: 💰

Installation

To install dbq, please use go get.

$ go get github.com/yoheimuta/dbq
...
$ dbq help
...

Or you can download a binary from github relases page and place it in $PATH directory.

Requirements

Usage

# no-option equal to `--beforeHour=3`
$ dbq query "SELECT * FROM [foo.bar@]"

# equal to SELECT * FROM [foo.bar@-10800000-]
$ dbq query "SELECT * FROM [foo.bar@]" --beforeHour=3

# equal to SELECT * FROM [foo.bar@1436371200000-]
$ dbq query "SELECT * FROM [foo.bar@]" --startDate="2015-07-08 17:00:00"

# equal to SELECT * FROM [foo.bar@1436371200000-1436382000000]
$ dbq query "SELECT * FROM [foo.bar@]" --startDate="2015-07-08 17:00:00" --endDate="2015-07-08 18:00:00"

# equal to SELECT * FROM [foo.bar@1436338800000-]
$ dbq query "SELECT * FROM [foo.bar@]" --startDate="2015-07-08 17:00:00" --tz="-9"

# equal to SELECT * FROM [foo.bar@1436338800000-] WHERE DATE_ADD('2015-07-08 17:00:00', -9, 'HOUR') <= time and time <= DATE_ADD('2015-07-08 18:00:00', -9, 'HOUR')
$ dbq query "SELECT * FROM [foo.bar@] WHERE _tz(2015-07-08 17:00:00) <= time and time <= _tz(2015-07-08 18:00:00)" --startDate="2015-07-08 17:00:00" --tz="-9"

Placeholders

  • @ will be replaced with @<time1>-<time2>
  • required
  • _tz(datetime) will be replaced with DATE_ADD('datetime', tz value, 'HOUR')
  • optional

DryRun

The option of dryRun shows how much cut down full scan bytes, so I strongly recommend to use this option before running any queries.

  • A query with no table decorator will process 6.0 TiB, then costs 6.0 * $5 = $30.
  • A query with table decorator will process 110 GiB, then costs 0.1 * $5 = $0.5. dbq will save $29.5.
$ dbq query "SELECT * FROM [foo.bar@]" --dryRun
Raw: SELECT * FROM [foo.bar]
Query successfully validated. Assuming the tables are not modified, running this query will process 6630178173385 bytes of data.
- 6630178173385 bytes equal to 6,630,178,173,385 bytes
- 6630178173385 bytes equal to 6.0TiB
- 6630178173385 bytes equal to $30.15056 (= 6.03011 TiB * $5)

Decorated: SELECT * FROM [foo.bar@-10800000-]
Query successfully validated. Assuming the tables are not modified, running this query will process 117636313873 bytes of data.
- 117636313873 bytes equal to 117,636,313,873 bytes
- 117636313873 bytes equal to 110GiB
- 117636313873 bytes equal to $0.53495 (= 0.10699 TiB * $5)

Options

$ dbq help query
NAME:
   query - Run bq query with complementing table range decorator

USAGE:
   command query [command options] [arguments...]

DESCRIPTION:


OPTIONS:
   --beforeHour '3'     a decimal to specify the hour ago, relative to the current time
   --startDate          a datetime to specify date range with end flag
   --endDate            a datetime to specify date range with start flag
   --tz '0'             a decimal of hour or -hour to add to start and end datetime, considering timezone
   --buffer '1'         a decimal of hour to add to start and end datetime, it's heuristic value
   --gflags             no support. Use onlyStatement instead
   --cflags             no support. Use onlyStatement instead
   --verbose            a flag to output verbosely
   --dryRun             a flag to run without any changes
   --onlyStatement      a flag to output only a decorated statement

CHANGELOG

See CHANGELOG

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].