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 = [{'schema': [('name', 'STRING'), ('value', 'INT64')], 'datum': [['abc', 100]], 'name': 'INPUT_DATA'}]
query = {'query': 'SELECT * FROM hogehoge', 'map': {'hogehoge': 'INPUT_DATA'}, '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.2.1.tar.gz
(8.2 kB
view details)
Built Distribution
File details
Details for the file bqqtest-0.2.1.tar.gz
.
File metadata
- Download URL: bqqtest-0.2.1.tar.gz
- Upload date:
- Size: 8.2 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 | 18fdd5f31bacc2ffdb7561bd3e81a1b278e2f22a25cb272e68739b6c8fe56e6f |
|
MD5 | b1e9428ad20f367ff595eec3f77c1eee |
|
BLAKE2b-256 | 860c688e1dadae15f12a11a5a6a93204f6841586aea0aed019af63603b6e024a |
File details
Details for the file bqqtest-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: bqqtest-0.2.1-py3-none-any.whl
- Upload date:
- Size: 9.1 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 | bceeea088810e8cc795522bb8410b06a09d0c204213514315d21a3037fb9e79f |
|
MD5 | 41bd8bc00b568232b11eeff210512d98 |
|
BLAKE2b-256 | 5afdddf5e13b5eff31cf49fe75c4da7fa51c28e3b6f2b044f08708d14d67af16 |