Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

[BigQuery] Retrieve old query from a scheduled query / Control Change on Scheduled Queries

Hi Everybody!

Writing to ask a question about Scheduled Queries in BigQuery.

Our Data Team had a scheduled query (that populated two tables) running for a couple of months now, and we believe someone might have accidently deleted a piece of code. We know that the change was done on Feb 8, so our doubt is, is there any way we can retrieve the code that was in the scheduled query before Feb 8? As of now, if I go to the scheduled query > configuration > query string I see the new one.

Thanks in advance!

Sofi

Solved Solved
0 1 2,238
1 ACCEPTED SOLUTION

Haha, me again. I've solved it, so I'll leave it here in case someone needs it:

  1. Enter on the scheduled query, and click on a day where you are sure the old version was run.
  2. Copy the job name (it should look something like this mock example: scheduled_query_75adfjida2-9654-5884-4547-001affadf56)
  3. Open Cloud Shell Terminal
  4. Write bq --format=prettyjson show -j jobname

Query will appear below!!! 

Didn't figure out myself, but used this lifesaver link.

View solution in original post

1 REPLY 1

Haha, me again. I've solved it, so I'll leave it here in case someone needs it:

  1. Enter on the scheduled query, and click on a day where you are sure the old version was run.
  2. Copy the job name (it should look something like this mock example: scheduled_query_75adfjida2-9654-5884-4547-001affadf56)
  3. Open Cloud Shell Terminal
  4. Write bq --format=prettyjson show -j jobname

Query will appear below!!! 

Didn't figure out myself, but used this lifesaver link.