# bruneus
[![Maintainability](https://api.codeclimate.com/v1/badges/c9d020ea15b032c4cefb/maintainability)](https://codeclimate.com/github/yokoe/bruneus/maintainability)
BigQuery helper library for Python
## How to use
### Select from table
```
import bruneus
bruneus.select("SELECT * FROM `foo.bar.purchases` LIMIT 20").as_dicts()
bruneus.select("SELECT * FROM `foo.bar.purchases` ORDER BY created_at LIMIT 1", client=bigquery.Client(project="foobar")).first_as_dict()
bruneus.select("SELECT * FROM `foo.bar.purchases` LIMIT 20").to_dataframe()
```
### Create table from query
```
bruneus.select("SELECT * FROM `some.source.table`").to_table("foo.bar.new_table")
```
### Create temp table from query
```
bruneus.select("SELECT * FROM `some.source.table`").to_table("foo.bar.new_table").expires_in(days=7)
```
### Export table to GCS as csv
```
bruneus.export_table("foo.bar.sample").as_csv(gzip=True).to_gcs("my-bucket", "exported-table.csv.gz")
```
### Generate random table name
```
bruneus.random_table_name("prefix-here")
```
## Development
### Run tests
```
docker compose run bruneus
```
Raw data
{
"_id": null,
"home_page": "https://github.com/yokoe/bruneus",
"name": "bruneus",
"maintainer": "yokoe",
"docs_url": null,
"requires_python": "",
"maintainer_email": "kreuz45@kreuz45.com",
"keywords": "bigquery",
"author": "yokoe",
"author_email": "kreuz45@kreuz45.com",
"download_url": "https://files.pythonhosted.org/packages/7d/84/75a7178e6554b2c5405f7e664ce0df41d84a4708d57a5f819eccc38497eb/bruneus-0.1.14.tar.gz",
"platform": null,
"description": "# bruneus\n[![Maintainability](https://api.codeclimate.com/v1/badges/c9d020ea15b032c4cefb/maintainability)](https://codeclimate.com/github/yokoe/bruneus/maintainability)\n\nBigQuery helper library for Python\n\n## How to use\n### Select from table\n```\nimport bruneus\nbruneus.select(\"SELECT * FROM `foo.bar.purchases` LIMIT 20\").as_dicts()\nbruneus.select(\"SELECT * FROM `foo.bar.purchases` ORDER BY created_at LIMIT 1\", client=bigquery.Client(project=\"foobar\")).first_as_dict()\nbruneus.select(\"SELECT * FROM `foo.bar.purchases` LIMIT 20\").to_dataframe()\n```\n\n### Create table from query\n```\nbruneus.select(\"SELECT * FROM `some.source.table`\").to_table(\"foo.bar.new_table\")\n```\n\n### Create temp table from query\n```\nbruneus.select(\"SELECT * FROM `some.source.table`\").to_table(\"foo.bar.new_table\").expires_in(days=7)\n```\n\n### Export table to GCS as csv\n```\nbruneus.export_table(\"foo.bar.sample\").as_csv(gzip=True).to_gcs(\"my-bucket\", \"exported-table.csv.gz\")\n```\n\n\n### Generate random table name\n```\nbruneus.random_table_name(\"prefix-here\")\n```\n\n## Development\n### Run tests\n```\ndocker compose run bruneus\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "bruneus: BigQuery helper utils.",
"version": "0.1.14",
"project_urls": {
"Download": "https://github.com/yokoe/bruneus",
"Homepage": "https://github.com/yokoe/bruneus"
},
"split_keywords": [
"bigquery"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7d8475a7178e6554b2c5405f7e664ce0df41d84a4708d57a5f819eccc38497eb",
"md5": "bd365f73098d37a2ed2c0430aac670c9",
"sha256": "b815dc8f5de55a11484265b4a44ce93b290eae49687842bb6e58a16ca010a7dd"
},
"downloads": -1,
"filename": "bruneus-0.1.14.tar.gz",
"has_sig": false,
"md5_digest": "bd365f73098d37a2ed2c0430aac670c9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5602,
"upload_time": "2024-03-12T01:20:46",
"upload_time_iso_8601": "2024-03-12T01:20:46.881623Z",
"url": "https://files.pythonhosted.org/packages/7d/84/75a7178e6554b2c5405f7e664ce0df41d84a4708d57a5f819eccc38497eb/bruneus-0.1.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-12 01:20:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yokoe",
"github_project": "bruneus",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "bruneus"
}