Dump the table to GCS in CSV GZIP compression format.
environment
code
from google.cloud.bigquery import Client
from google.cloud.bigquery.job import ExtractJobConfig, DestinationFormat, Compression, ExtractJob
client = Client(project="your_prject_id", location="US")
job_config: ExtractJobConfig = ExtractJobConfig(
compression=Compression.GZIP,
destination_format=DestinationFormat.CSV
)
extract_job: ExtractJob = client.extract_table(
source="your_dataset.your_table",
destination_uris="gs://your_bucket/hoge.csv.gz",
job_config=job_config)
extract_job.result() #Wait for completion
Recommended Posts