Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orisano/bqspec
SQL testing tool for Google BigQuery.
https://github.com/orisano/bqspec
bigquery cli python test yaml
Last synced: 5 days ago
JSON representation
SQL testing tool for Google BigQuery.
- Host: GitHub
- URL: https://github.com/orisano/bqspec
- Owner: orisano
- License: mit
- Created: 2017-11-26T13:47:14.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-08-02T02:49:21.000Z (over 1 year ago)
- Last Synced: 2024-11-02T09:51:41.642Z (12 days ago)
- Topics: bigquery, cli, python, test, yaml
- Language: Python
- Homepage:
- Size: 240 KB
- Stars: 10
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
BQSpec
===================================
.. image:: https://badge.fury.io/py/bqspec.svg
:target: https://badge.fury.io/py/bqspec
.. image:: https://img.shields.io/pypi/pyversions/bqspec.svg
:target: https://pypi.org/project/bqspec/SQL testing tool for Google BigQuery.
this library is pre-alpha. not recommended to production use.Getting Started
----------------
.. code:: bashpip 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 .
Author
-----------
Nao Yonashiro (@orisano)License
-----------
MIT