Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding the query that created a table in BigQuery

I am a new employee at the company. The person before me had built some tables in BigQuery. I want to investigate the create table query for that particular table.

Things I would want to check using the query is:

  1. What joins were used?
  2. What are the other tables used to make the table in question?

I have not worked with BigQuery before but I did my due diligence by reading tutorials and the documentation. I could not find anything related there.

like image 314
Aman Mathur Avatar asked Sep 06 '25 03:09

Aman Mathur


1 Answers

Brief outline of your actions below:

Step 1 - gather all query jobs of that user using Jobs.list API - you must have Is Owner permission for respective projects to get someone else's jobs

Step 2 - extract only those jobs run by the user you mentioned and referencing your table of interest - using destination table attribute

Step 3 - for those extracted jobs - just simply check respective queries which allow you to learn how that table was populated

Hth!

like image 50
Mikhail Berlyant Avatar answered Sep 08 '25 23:09

Mikhail Berlyant