简体   繁体   中英

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!

OK, I was really dumb. The project name is a combination of letters and numbers, but this on the top left of the cloud console only the letters are being shown. I had forgotten to put the numbers in the projectId and this is why it was not working (I was not referring to the proper project).

Hope that saves someone else the hassle!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM