Access Denied: User does not have bigquery.jobs.create permission

Viewed 15381

Since a few days ago, I've been getting the following error when running any query on the GHTorrent and SOTorrent datasets on BigQuery:

Access Denied: Project ghtorrent-bq: User does not have bigquery.jobs.create permission in project ghtorrent-bq.

The error shows up even for the simplest queries, such as SELECT * FROM 'ghtorrent-bq.ght.issues' LIMIT 1000. The same query worked without any problems until a few days ago, and I have no idea what might cause this new behaviour.

5 Answers

The **ghtorrent-bq** and **sotorrent-org** are projects with public datasets. Therefore, you should be able to access its data as long as you are compliant with the dataset permissions. You can check it as follows (in the example I will be using the ghtorrent-bq project and ght dataset):

  1. Click at the project, in the bottom left side of the BigQuery console

  2. Select the dataset, in this case I selected ght

  3. Below the query editor, click SHARE DATASET

  4. Now, under the tab DATASET PERMISSIONS you can see the authorised menmber and each role

  5. Click the BigQuery Data Viewer role, you can see that one of the members is allAuthenticatedUsers

Therefore, if you are authenticated with a google account using BigQuery, you should be able to see the data within the dataset.

The next point, and usual cause of this error, you should check if you selected the project. I was able to reproduce your error when not selecting the project. Inside the BigQuery Console, on the upper right side of the screen, confirm if there is a project selected -if not, it will be written Select Project. After selecting the project, you should have the permission to run a query against the data within these datasets.

Stumbled upon this answer with a slightly different problem.

If that's your case too, you might need to give the reading user not only the BigQuery Data Viewer permission but also BigQuery Job User:

permissions

There's no longer a bigquery job user role. There's a metadata viewer, data viewer, data owner, data editor roles.

I granted all 4 of these to both the project and dataset and still get the error Access Denied...User does not have bigquery.datasets.create permission in project. Even though it's owner of the project!

You need to select a project, in the bottom left side of the BigQuery console

Even though after giving all access to the user, are still facing access denied error then there's one more thing to do which might help you to solve this issue. In my case it works so I think you should try as well.

string projectId = "YourProjectID";
var client = BigQueryClient.Create(projectId);
using (var fs = new FileStream(@"jsonPath", FileMode.Open, FileAccess.Read))
        {
            var credentialParameters = NewtonsoftJsonSerializer.Instance.Deserialize<JsonCredentialParameters>(fs);
        }

With the help of above mentioned code you'll be able to find email id of that user and then check whether that user have all necessary access or not.

Related