Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can BigQuery View reference other Tables and Views from different datasets/projects?

According to BigQuery Views docs: "Also, views can only reference other tables and views with the same Dataset location."

But in fact i can create a View like this (query is just for example):

SELECT a.body 
FROM [fh-bigquery:reddit_comments.2008] as a
inner JOIN flatten([bigquery-samples:playlists.playlists],tracks.data)
as b ON a.author=b.tracks.data.artist.name

And then reference this view in query like a normal table:

SELECT * FROM [flow-1202:alex_centre.test_v_501] LIMIT 1000

And it works.

Do we have more restrictions when using Views instead of Subqueries in BigQuery?

like image 568
Alexander Kalitenya Avatar asked Oct 15 '25 21:10

Alexander Kalitenya


1 Answers

In the quote you referenced - the key word is "location"!
You cannot reference tables/views from different location in same view See more about Dataset Location here - https://cloud.google.com/bigquery/docs/managing_jobs_datasets_projects#datasets

in the example from your question - both tables are in us location - thus it works!

like image 60
Mikhail Berlyant Avatar answered Oct 18 '25 22:10

Mikhail Berlyant