I have deleted a view in bigquery. I came to know there is an option to restore deleted tables based on table snapshot decorators. Is there any way to retrieve deleted bigquery views?
Undelete in BigQuery is possible via table copy and snapshot decorators. That is, you can copy a snapshot of the table from before the table was deleted. BigQuery used to have restrictions on undeletes, but over time, those have been removed.
You can delete a view by: Using the Google Cloud console. Using the bq command-line tool's bq rm command.
The easiest way would be in the GCP console click in the "ACTIVITY" tab, filter the "Resource Type" by "Big Query" and look for the "Delete Table" entry. If you click the entry it'll expand and show info about the deletion, along with the account that performed the deletion.
There is a way to get it back. You need to search for insertion logs rolled at a time of creating your view. This logs can be seen from stackdriver logging. Here are the steps :
Go to GCP console
Click on stackdriver logging
resource.type="bigquery_resource"
protoPayload.methodName="tableservice.insert"
protoPayload.serviceData.tableInsertRequest.resource.tableName.tableId="Your_view_name"
Alternatively, if you want to search for updates to the view to recover a specific version you can use the following filter:
resource.type="bigquery_resource"
protoPayload.serviceData.tableUpdateRequest.resource.tableName.datasetId="<dataset_id>"
protoPayload.resourceName="projects/<project_id>/datasets/<dataset_id>/tables/<table_or_view_id>"
I hope this helps you get back your BQ view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With