SQL testing tool for Google BigQuery
Project description
BQSpec
===================================
| SQL testing tool for Google BigQuery.
| this library is pre-alpha. not recommended to production use.
| (under construction now)
Getting Started
--------
.. code:: bash
pip install bqspec
.. code:: bash
gcloud auth application-default login
How to Use
--------
spec.yaml
.. code:: 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
.. code:: bash
bqspec -f spec.yaml
or
.. code:: bash
bqspec -d .
License
--------
MIT
===================================
| SQL testing tool for Google BigQuery.
| this library is pre-alpha. not recommended to production use.
| (under construction now)
Getting Started
--------
.. code:: bash
pip install bqspec
.. code:: bash
gcloud auth application-default login
How to Use
--------
spec.yaml
.. code:: 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
.. code:: bash
bqspec -f spec.yaml
or
.. code:: bash
bqspec -d .
License
--------
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bqspec-0.2.0.tar.gz
(7.8 kB
view hashes)
Built Distribution
bqspec-0.2.0-py2.py3-none-any.whl
(11.5 kB
view hashes)
Close
Hashes for bqspec-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c05188d4317fceb5e3b3613d838a945bb9de3df77933892423a63bdfc6fc0e94 |
|
MD5 | 1a26b2293ab4d309297227dc12c227fc |
|
BLAKE2b-256 | 4eacc44b79760b1f60b777c1386598fbf7606e49fe8217f7bff2329251aedfd4 |