# Torch Data Bigquery
[![PyPI - Version](https://img.shields.io/pypi/v/torch-data-bigquery.svg)](https://pypi.org/project/torch-data-bigquery)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/torch-data-bigquery.svg)](https://pypi.org/project/torch-data-bigquery)
-----
Torch `Dataset` interface for Google BigQuery datasets.
**Table of Contents**
- [Torch Data Bigquery](#torch-data-bigquery)
- [Installation](#installation)
- [Examples](#examples)
- [License](#license)
## Installation
```console
pip install torch-data-bigquery
```
## Examples
`BigQueryStorageDataset`
```python
import torch
from torch_data_bigquery import BigQueryStorageDataset
dataset = BigQueryStorageDataset(
billing_project=PROJECT,
selected_fields=[
"PassengerId",
"Survived",
"Pclass",
],
location=f"bq://your-gcp-project.kaggle_titanic.train",
)
dataloader = torch.utils.data.DataLoader(dataset)
```
`BigQueryDataset`
```python
import torch
from torch_data_bigquery import BigQueryDataset
dataset = BigQueryDataset(
billing_project=PROJECT,
query=f"""
SELECT
Survived AS survived, # 1
Pclass AS pclass, # 2
DENSE_RANK() OVER(ORDER by Sex) AS sex, # 3
COALESCE(Age, AVG(Age) OVER()) AS age, # 4
SibSp AS siblings, # 5
Parch AS parents, # 6
Fare AS fare, # 7
DENSE_RANK() OVER(ORDER by Embarked) AS embarked, # 8
FROM `your-gcp-project.kaggle_titanic.train`
""",
)
dataloader = torch.utils.data.DataLoader(dataset)
```
## License
`torch-data-bigquery` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
Raw data
{
"_id": null,
"home_page": null,
"name": "torch-data-bigquery",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "bigquery,google-cloud,pytorch,torch",
"author": "Sebastian Pawlu\u015b",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/c4/00/39b9057e3b56164923fec11397a97e88760771c01d69c35c5d76114daba7/torch_data_bigquery-0.0.2.tar.gz",
"platform": null,
"description": "# Torch Data Bigquery\n\n[![PyPI - Version](https://img.shields.io/pypi/v/torch-data-bigquery.svg)](https://pypi.org/project/torch-data-bigquery)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/torch-data-bigquery.svg)](https://pypi.org/project/torch-data-bigquery)\n\n-----\n\nTorch `Dataset` interface for Google BigQuery datasets.\n\n\n**Table of Contents**\n\n- [Torch Data Bigquery](#torch-data-bigquery)\n - [Installation](#installation)\n - [Examples](#examples)\n - [License](#license)\n\n## Installation\n\n```console\npip install torch-data-bigquery\n```\n\n## Examples \n\n`BigQueryStorageDataset`\n\n```python\n\nimport torch\nfrom torch_data_bigquery import BigQueryStorageDataset\n\ndataset = BigQueryStorageDataset(\n billing_project=PROJECT,\n selected_fields=[\n \"PassengerId\",\n \"Survived\",\n \"Pclass\",\n ],\n location=f\"bq://your-gcp-project.kaggle_titanic.train\",\n)\n\ndataloader = torch.utils.data.DataLoader(dataset)\n\n```\n\n\n`BigQueryDataset` \n\n```python\n\nimport torch\nfrom torch_data_bigquery import BigQueryDataset\n\ndataset = BigQueryDataset(\n billing_project=PROJECT,\n query=f\"\"\"\n SELECT\n Survived AS survived, # 1\n Pclass AS pclass, # 2\n DENSE_RANK() OVER(ORDER by Sex) AS sex, # 3 \n COALESCE(Age, AVG(Age) OVER()) AS age, # 4\n SibSp AS siblings, # 5\n Parch AS parents, # 6\n Fare AS fare, # 7\n DENSE_RANK() OVER(ORDER by Embarked) AS embarked, # 8\n FROM `your-gcp-project.kaggle_titanic.train`\n \"\"\",\n)\n\ndataloader = torch.utils.data.DataLoader(dataset)\n\n```\n\n\n## License\n\n`torch-data-bigquery` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "0.0.2",
"project_urls": {
"Documentation": "https://github.com/xando/torch-data-bigquery#readme",
"Issues": "https://github.com/xando/torch-data-bigquery/issues",
"Source": "https://github.com/xando/torch-data-bigquery"
},
"split_keywords": [
"bigquery",
"google-cloud",
"pytorch",
"torch"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "44661e3bc6e3268e91f19fefb58de4682630f14f2cb3558f9cc25d0658d8b95a",
"md5": "e902cb57f39b753caf6341b54dfb1f9d",
"sha256": "5c830e13280c0879241326cb76d1607588b9c40f9fb77b3124111a18be13757d"
},
"downloads": -1,
"filename": "torch_data_bigquery-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e902cb57f39b753caf6341b54dfb1f9d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5396,
"upload_time": "2024-02-11T23:03:32",
"upload_time_iso_8601": "2024-02-11T23:03:32.412640Z",
"url": "https://files.pythonhosted.org/packages/44/66/1e3bc6e3268e91f19fefb58de4682630f14f2cb3558f9cc25d0658d8b95a/torch_data_bigquery-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c40039b9057e3b56164923fec11397a97e88760771c01d69c35c5d76114daba7",
"md5": "c07f9b345ae40d320ced41669bb7e6d8",
"sha256": "6f8fef2fea653bb82843faf2c49a2584505945862a077e73646079234042c526"
},
"downloads": -1,
"filename": "torch_data_bigquery-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "c07f9b345ae40d320ced41669bb7e6d8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4784,
"upload_time": "2024-02-11T23:03:34",
"upload_time_iso_8601": "2024-02-11T23:03:34.058910Z",
"url": "https://files.pythonhosted.org/packages/c4/00/39b9057e3b56164923fec11397a97e88760771c01d69c35c5d76114daba7/torch_data_bigquery-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-11 23:03:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "xando",
"github_project": "torch-data-bigquery#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "torch-data-bigquery"
}