BQSpec
SQL testing tool for Google BigQuery.
this library is pre-alpha. not recommended to production use.
Getting Started
pip install bqspec
gcloud auth application-default login
How to Use
spec.yaml
# test target SQL filepath
query_path: ./sample.sql
# any BigQuery query parameters (optional). more details: https://cloud.google.com/bigquery/docs/parameterized-queries
params:
- type: DATE
name: date
value: 2017-11-30
# known columns (optional).
columns:
- id
- a
- b
- c
- total
# conditions which all rows must met (optional).
invariants:
- total >= 0 # write python expression
- a + b == c
# any test cases
cases:
- where:
- id == 1
expected:
- total == 15
- a == 2
- b == 3
- c == 5
bqspec -f spec.yaml
or
bqspec -d .
Author
@orisano (Nao YONASHIRO)
License
MIT