google-big-queryHow do I use Google Big Query to zip files?
Google BigQuery does not natively support zipping files. To use BigQuery to zip files, you will need to export the files to Google Cloud Storage, then use the gsutil command line tool to zip the files.
The following example code will export the file named my_file.csv from BigQuery to Google Cloud Storage, then zip the file:
bq extract --destination_format=CSV 'my-project:my-dataset.my_table' gs://my-bucket/my_file.csv
gsutil cp gs://my-bucket/my_file.csv gs://my-bucket/my_file.zip
This code will create a zip file named my_file.zip in the Google Cloud Storage bucket my-bucket.
The code consists of two parts:
bq extract: This command will export the tablemy-project:my-dataset.my_tablefrom BigQuery to the filemy_file.csvin the Google Cloud Storage bucketmy-bucket.gsutil cp: This command will copy the filemy_file.csvfrom the Google Cloud Storage bucketmy-bucketto the filemy_file.zipin the same bucket.
For more information about the bq extract and gsutil cp commands, see the following links:
More of Google Big Query
- How do I use a Google BigQuery URL?
- How can I compare Google BigQuery and Amazon Redshift for software development?
- How do I use Google Big Query with Zoom?
- How do I update data in Google BigQuery?
- How do I use Google Big Query to create a tutorial?
- How much does Google Big Query cost?
- How can I set up high availability for Google BigQuery?
- How can I use Google Big Query to analyze data from the GDELT project?
- How can I use Google Big Query to integrate with Zephyr?
- How do I set up a Google Big Query zone?
See more codes...