How can one back up a Project containing datasets in Google BigQuery to another GCS bucket? Is it feasible to employ a Python script for this task, and how can the process be automated?
Just trying to gather ideas to implement for Disaster Recovery. To clone Project into another GCP bucket
the data structure as below:
Project -> dataset -> table
-> table
-> ...
-> dataset -> table
-> table
-> ...
-> ...
Now for the next part - it is definitely possible to create a python script that performs this backup. You could even run it as a Google Cloud Function using a Google Cloud Service Account on a schedule, and it will automatically copy your entire dataset / project into whatever location you decide to do that.
You should use the
google-bigquerypython package for that, which will allow you to connect to bigquery and create an export job.You can refer to this example code provided by Google's Documentation to get started: