rgoogle-cloud-platformgoogle-bigquerytidyversebigrquery

Keep getting Access Denied when connecting to BigQuery with R


I am very new to GCP and BigQuery and I am trying to query a simple dataset that I have uploaded on Google BigQuery by using R. In the IAM settings, I am listed as an "BigQuery Admin", "BigQuery Data Owner" and "Owner."

I can also query the dataset using the console, but every time I keep getting an

access denied, User does not have bigquery.jobs.create permission in project ABCD

Here is my code:

library("tidyverse")
library("bigrquery")
bq_auth(use_oob = TRUE)


# Store the project id
projectid = "ABCD"

# Set your query
sql <- "SELECT * FROM test.testtable"

# Run the query and store the data in a dataframe
mydf <- query_exec(sql, projectid, use_legacy_sql = FALSE)

# Print the query result
mydf 

All the sources I have found so far tell me to activate the setting for Big Query in the IAM settings - but I have already done it, so I am at a loss on what to do further. Would appreciate the help!


Solution

  • This definetly seems to be a permission issue. Can you make sure that this program is using your credentials not some other service account credentials?

    If you are running from your laptop, you can run gcloud auth list to find out the credential in use.