Test BigQuery query using BigQuery
Project description
WIP: BigQueryのクエリをテストするためのツール
BigQueryへのクエリロジックのテストができます
Basic Usage
from bqqtest import QueryTest
from google.cloud import bigquery
expected = {'schema': [('name', 'STRING'), ('value', 'INT64')], 'datum': [['abc', 100]]}
tables = [{'name': 'hogehoge','schema': [('name', 'STRING'), ('value', 'INT64')], 'datum': [['abc', 100]]}]
query = {'query': 'SELECT * FROM hogehoge', 'params': []}
qt = QueryTest(bigquery.Client(), expected, tables, query)
success, diff = qt.run()
success # True
特徴
- WITHを利用してテストデータを一時的に生成します。このデータはBigQueryに保存されません。BigQueryは保存されているデータ走査した量とAPIリクエスト数で課金されるため、課金額を抑えた状態でテストできます
- テストしたいクエリ中の文字列を置換することで、FROMで指定しているテーブルを書き換えます。テストのためにクエリを書き直す必要はありません
注意
BigQueryへ直接クエリを発行します。
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
bqqtest-0.3.1.tar.gz
(8.3 kB
view details)
Built Distribution
File details
Details for the file bqqtest-0.3.1.tar.gz
.
File metadata
- Download URL: bqqtest-0.3.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.7.6 Darwin/18.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15bdc1848e348627090d5bbf7eab4a54b7fd74fc90eea7cd8da8bc81daded6bd |
|
MD5 | 46adb0984c45160c76eb3bf3bd84374b |
|
BLAKE2b-256 | b5edd9711daa54af6b366558c6a098dfe5b1ec2725822c5ad657cdf84e1aa98c |
File details
Details for the file bqqtest-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: bqqtest-0.3.1-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.7.6 Darwin/18.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37a14aa93eb57c62ec76e7babed71309d0efc27ce5c2db8ddeb87777dca430d5 |
|
MD5 | 8a9ce8f04b5a88c039d668a6b45d1e7f |
|
BLAKE2b-256 | e897d8b1b9b5e933b1c295bcd58436827420bc862a6ca8ec362fe48680fc9f3f |