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 bqem_master_schema.yaml
).
If schema definition cannot be found, SchemaManager
request it from BigQuery in production environment 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
File details
Details for the file bqemulatormanager-0.2.2.tar.gz
.
File metadata
- Download URL: bqemulatormanager-0.2.2.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e30dc45f8d03821e7da049e9b2d653b6df924097a459a6b2a69d4416354ed68 |
|
MD5 | ac575122c0f507bc7bcb2354219ad656 |
|
BLAKE2b-256 | 16f2609dbda0a330002fcd7ce647f32ef28074edcd6647368d997c61475b6109 |
File details
Details for the file bqemulatormanager-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: bqemulatormanager-0.2.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59b2bb6c3bead22a283738a2332f8343e2c58031acdf6764dc3b016396e012d7 |
|
MD5 | dc2a09062c2049409d3590017dac6b36 |
|
BLAKE2b-256 | a7cc21c62cbc6f3833e6a767ed335e98c4ae6b97b7bbd5740d18f221690c349a |