Skip to main content

Export Large Results from BigQuery to Google Cloud Storage

Project description

# BigQuery-GCS
[![Build Status](](
Dealing with large query results isn't so [straightforward in BigQuery]( . This library provides wrapper to help you execute query with large results and export it to Goolge Cloud Storage for ease of accessibility.

1. Run your query.
2. Output results to a temporary table.
3. Export temporary table data to GCS.
4. Delete temporary table.

## Installation

pip install bigquery-gcs

## Examples
from bigquery_gcs import Exporter

config = {

'BQ_DEFAULT_QUERY_TIMEOUT': 86400, # 24 hours
'BQ_DEFAULT_EXPORT_TIMEOUT': 86400, # 24 hours

exporter = Exporter(config)

query = "SELECT word FROM [publicdata:samples.shakespeare] LIMIT 1000"
dataset_temp = "temp"
table_temp = "shakespeare_word"
folder_name = "shakespeare" # This is your GCS folder to store result files
file_name = "shakespeare_word" # Name for exported file in GCS

# This will run query and export results to GCS
exporter.query_and_export(query, dataset_temp, table_temp, folder_name, file_name)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution (11.2 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page