Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the Last Modified date for all BigQuery tables in a BigQuery Project

I have several databases within a BigQuery project which are populated by various jobs engines and applications. I would like to maintain a dashboard of all of the Last Modified dates for every table within our project to monitor job failures.

enter image description here

Are there any command line or SQL commands which could provide this list of Last Modified dates?

like image 347
unique_beast Avatar asked May 31 '17 15:05

unique_beast


1 Answers

For a SQL command you could try this one:

#standardSQL
SELECT *, TIMESTAMP_MILLIS(last_modified_time)
FROM `dataset.__TABLES__` where table_id = 'table_id'

I recommend you though to see if you can log these errors at the application level. By doing so you can also understand why something didn't work as expected.

If you are already using GCP you can make use of Stackdriver (it works on AWS as well), we started using it in our projects and I recommend giving it a try (we tested for python applications though, not sure how the tool performs on other clients but it might be quite similar).

like image 136
Willian Fuks Avatar answered Sep 18 '22 15:09

Willian Fuks