Skip to main content

Test BigQuery query using BigQuery

Project description

WIP: BigQueryのクエリをテストするためのツール

Run pytest

BigQueryへのクエリロジックのテストができます

Basic Usage

from bqqtest import QueryTest
from google.cloud import bigquery

expected = {'schema': [('name', 'STRING'), ('value', 'INT64')], 'datum': [['abc', 100]]}
tables = {'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


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.4.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

bqqtest-0.4.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file bqqtest-0.4.0.tar.gz.

File metadata

  • Download URL: bqqtest-0.4.0.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

Hashes for bqqtest-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b7def7e3266bcb227be5aae95cfd3d599c924192cef2b0b1fdc8b3ca8be69693
MD5 6316bf531c4c85346651efed230acd0d
BLAKE2b-256 57d3fcdf1f916eb947d38a316360ff30e9b9511f9853b0bd79de3aaed726aa9d

See more details on using hashes here.

File details

Details for the file bqqtest-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: bqqtest-0.4.0-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

Hashes for bqqtest-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d941fd4a5cef3571a04ec0f5c3319a8a82915efc9dce9971f2b3c91b35d48bf8
MD5 b712d1448d99408aa316c33713930ae8
BLAKE2b-256 058bc0f791a56f0c12b26033fb25e9c74ae683e927d5c3d9de95d84f2ff218ee

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page