Reputation: 529
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!
Upvotes: 1
Views: 1530
Reputation: 4751
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.
Upvotes: 1
Reputation: 529
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!
Upvotes: 1