bqemulatormanager is a wrapper of bigquery-emulator which provides us BigQuery mock working in local machine.
Project description
BiqQueryEmulator Manager
this package is wrapper of bigquery-emulator which provides us BigQuery mock working in local machine.
using this package, you can
- do unit test of your sql
- download the schema of big query, and use it to make test data
usage
-
following instruction, download
bigquery-emulator
command. -
install this package.
pip install bqemulatormanager
- test your sql.
import bqemulatormanager as bqem
import pandas as pd
manager = bqem.Manager(project='test', schema_path='resources/schema_example.yaml')
with manager:
data = pd.DataFrame([
{'id': 1, 'name': 'sato'},
{'id': 2, 'name': 'yamada'}
])
manager.load(data, 'dataset1.table_a')
sql = 'SELECT id, name FROM `dataset1.table_a`'
df = manager.query(sql)
print(df)
unit test example is here.
automatically detect schema
When called Manager.load
, SchemaManager
search correspond table schema from schema_path
(default is master_schema.yaml
).
If schema definition canot be found, SchemaManager
request it from BigQuery in production environmant and update master schema file.
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
Built Distribution
Close
Hashes for bqemulatormanager-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce59229add36c6a0558e9c0c665f8fcedfbcb534951739ee05b9c3ee65f1740e |
|
MD5 | c0a56bdba6cfc571e328122f08607021 |
|
BLAKE2b-256 | 144a082cbb1dd7767cbc21f60581d53a024ddb85d630eaf5c47ebe39a8b16a92 |