bqhus: BigQuery helper utils.
Project description
bqhus
BigQuery helper utils for Python
How to use
Select from table
import bqhus
bqhus.select("SELECT * FROM `foo.bar.purchases` LIMIT 20").as_dicts()
bqhus.select("SELECT * FROM `foo.bar.purchases` ORDER BY created_at LIMIT 1", client=bigquery.Client(project="foobar")).first_as_dict()
bqhus.select("SELECT * FROM `foo.bar.purchases` LIMIT 20").to_dataframe()
Create table from query
bqhus.select("SELECT * FROM `some.source.table`").to_table("foo.bar.new_table")
Create temp table from query
bqhus.select("SELECT * FROM `some.source.table`").to_table("foo.bar.new_table").expires_in(days=7)
Export table to GCS as csv
bqhus.export_table("foo.bar.sample").as_csv(gzip=True).to_gcs("my-bucket", "exported-table.csv.gz")
Generate random table name
bqhus.random_table_name("prefix-here")
Development
Run tests
docker compose run bqhus
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
bqhus-0.1.11.tar.gz
(5.3 kB
view details)
File details
Details for the file bqhus-0.1.11.tar.gz.
File metadata
- Download URL: bqhus-0.1.11.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32d6b3acd201c5f7019fd619fdeba6beb745ab9395aa344011562f73469a8ce7
|
|
| MD5 |
94cdbdfa04a4ea113f2840e69d45d4c1
|
|
| BLAKE2b-256 |
537f457b1c0fc74ffdb74d201a2e02d3547ae5cbf82bfed1bc8be6dcc13b62d4
|