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 = [{'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


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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

Hashes for bqqtest-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f883ffd5a28f8ea19c3d9f09f9e836bfce08ab9c2f59a3a19bc74e6839493f02
MD5 a01cc147eb79d795e53b85aaba063a19
BLAKE2b-256 7e7b4290a82f98c44de815cb920b5bf05b6b27c2ae19a1ce9fa7a785219de381

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bqqtest-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8dcdd0c8d93dfbd40c70c3f8f5d1b60c55ef66beea169f06af1fc818e1109b3e
MD5 bb35592bd1e678b55771e9d1b65c58ba
BLAKE2b-256 d5db76b94c2c2ede5b92f4ec5638ec30d0d3b5727a2caf9ae2ed0176fe0ebff9

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