Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to run query against BigQuery - permission error 403

I have a IAM user with Role: BigQuery Data Editor In my data set I did Share dataset added the user with Can Edit privileges.

However when I'm running my script which access BigQuery I get error 403

When I add to my IAM user the Role BigQuery User The script works.

The scripts runs only SELECT query from a table in this data set.

I don't understand why I must grant BigQuery User for this to work.

According to the documentation https://cloud.google.com/bigquery/docs/access-control

Rationale: The dataEditor role extends bigquery.dataViewer by issuing create, update, delete privileges for the tables within the dataset

roles/bigquery.dataViewer has bigquery.tables.getData which get table data

What am I doing wrong here?

like image 303
Programmer120 Avatar asked Sep 27 '18 09:09

Programmer120


People also ask

What are the permissions of BigQuery dataeditor?

Having access to the data and being able to retrieve it with a query are different things and that's where the confusion is coming from. Per the documentation, roles/bigquery.dataEditor has the following permissions: Read the dataset's metadata and to list tables in the dataset. Create, update, get, and delete the dataset's tables.

Why can't I access certain BigQuery tables?

Certain BigQuery tables are backed by data managed by other Google product teams. This error indicates that one of these tables is unavailable. When you encounter this error message, you can retry your request (see internalError troubleshooting suggestions) or contact the Google product team that granted you access to their data.

What is a 403 Forbidden error?

Here are some examples of 403 error messages: Often, 403 forbidden errors are caused by an access misconfiguration on the client-side, which means you can usually resolve the issue yourself. A common cause of these errors is the file or folder permission settings, which control who can read, write, and execute the file or folder.

Why am I getting a BigQuery quota error?

This error returns when your project exceeds a BigQuery quota, a custom quota, or when you haven't set up billing and you have exceeded the free tier for queries. View the message property of the error object for more information about which quota was exceeded. To reset or raise a BigQuery quota, contact support .


1 Answers

Having access to the data and being able to retrieve it with a query are different things and that's where the confusion is coming from.

Per the documentation, roles/bigquery.dataEditor has the following permissions:

  • Read the dataset's metadata and to list tables in the dataset.
  • Create, update, get, and delete the dataset's tables.

This means that the user with this role has access and manipulation rights to the dataset's information and the tables in it. An example would be that a user with this role can see all the table information by navigating to it through the GCP console (schema, details and preview tabs) but when trying to run a query there, the following message will appear:

Access Denied: Project <PROJECT-ID>: The user <USER> does not have bigquery.jobs.create permission in project <PROJECT-ID>.

Now let's check the roles/bigquery.user permissions:

Permissions to run jobs, including queries, within the project.

The key element here is that the BigQuery User role can run jobs and the BigQuery DataEditor can't. BigQuery Jobs are the objects that manage the BigQuery tasks, this includes running queries.

With this information, it's clearer in the roles comparison matrix that for what you are trying to accomplish you'll need the BigQuery DataEditor role (Get table data/metadata) and the BigQuery User role (Create jobs/queries).

like image 54
Guillermo Cacheda Avatar answered Oct 17 '22 07:10

Guillermo Cacheda