Google BigQuery Shared Dataset and Billing Costs

Viewed 217

Lets assume user_A is the owner of Dataset_A which belongs to project_A and he wants to share the Dataset_A with user_B (user_B default project is project_B).

After sharing Dataset_A with user_B (Open Dataset -> Permissions -> Add Principal -> BigQuery Data Viewer role), user_B can see project_A pinned in his BigQuery Explorer - left navbar in UI (so now he can see 2 projects project_B and newly shared project_A).

It is clear that storage costs of Dataset_A occur to project_A. But what happens when user_B queries the shared Dataset_A (i.e of user_B queries -> SELECT * FROM project_A.Dataset_A.table) ?

The query costs/processing costs occur to project_B?

2 Answers

When a user has only the BigQuery Data Viewer role in a project, he is not able to run queries in that project. So, in your example, user_B won't be able to run a query while project_A is selected.

However, if she has a more powerful role in project_B (like BigQuery Admin), she can run a query against Dataset_A from project_B. In that case, the job will be run in project_B so this is the project that will be charged.

As you mentioned, storage costs only apply to project_A. You can take a look at all the available pre-defined BQ roles here.

If User_B can just access the data from Project_A, Bigquery usage will be billed to Project_B.

User_B can only make charges in Project_A if BigQuery retrieves data from a storage bucket inside Project_A.

To avoid this scenario, you could set requester pays in that Bucket.

Related