Using BigQuery for AdSense data - 403 Access Denied - google-bigquery

I've been successfully using BigQuery to pull AdSense data, but recently all queries have started failing, with this error:
(403) Access Denied: Table
google.com:adsense-reports:Reports.DailyCustomChannelReport: The user
does not have permission to query a table in dataset
google.com:adsense-reports:Reports
Here's a sample query:
SELECT matched_ad_requests, clicks, FROM [google.com:adsense-reports:Reports.DailyCustomChannelReport] WHERE date BETWEEN '2015-02-10' AND '2015-02-11'AND custom_channel_code like 'test_18'
These query failures aren't associated with any code change to my application. They also fail in the BigQuery browser tool- even queries that ran successfully in the past. This seems to rule out a problem with the query.
Nothing has changed with regards to my account access to AdSense. I am able to log in to the dashboard and see all data.
Any ideas how I can restore my ability to query this data? Thanks.

I got internal confirmation: The AdSense experiment for BigQuery was discontinued. The team tells me they notified the experiment users some months ago, before disabling it.
Sorry for the lack of better news!

Related

Problem with Google BigQuery Rest API via Power BI

I have a problem scheduling refresh in the Power Bi service for the google Big Query database.
It used to work fine and since last Friday Power Bi cannot connect to gbq anymore.
I tried Microsoft Support but they send me to you.
This is the error I receive:
ODBC: ERROR [HY000] [Microsoft][DriverOAuthSupport] (8701) Error interacting with REST API: Couldn't connect to server ERROR [HY000] [Microsoft][DriverOAuthSupport] (8701) Error interacting with REST API: Couldn't connect to server Table: CS_Scorecard.
Cluster URI: WABI-WEST-EUROPE-B-PRIMARY-redirect.analysis.windows.net
Activity ID: 07d42767-95e3-4bbc-81e8-6953be164caa
Request ID: f1b4b205-4228-4f16-8d6d-e98b28eec5c7
Time: 2019-12-10 12:43:12Z
I tried creating a new model with 1 gbq link and that worked fine. But my existing model is failing right now.
Any ideas on how to resolve this?
According with Power BI support page this issue is known.
Seems that the issue may be caused by a lack of permissions for the user attempting to establish a connection.
You will need to check that the account being used has the appropriate permissions, in particular "bigquery.tables.list" permission needs to be assigned.
Check the BigQuery roles and permissions.
I suggest confirming that there are no custom IAM roles or roles type set up on the dataset(s) you are trying to connect to.
Verify that you are using the last version of Simba drivers for BigQuery.
Finally you can look the following Public Issue Tracker, where this issue was reported.
thank you for your answer.
The Power Bi user has the Data Viewer role and we haven't any custom role on this dataset.
About the driver, we are trying to refresh a dataflow on the PBI Server, not in Desktop, so I guess the driver is updated.
Thank you.

How do I avoid "Error creating scheduled query: The caller does not have permission" when setting up a BigQuery scheduled query?

I am trying to set up a scheduled query in BigQuery through the web UI in GCP but I am getting:
Error creating scheduled query: The caller does not have permission
I am creating this query outside of my organisation (under another organisation), but my email address has been given bigquery.transfers.update permission within the other organisation. Previously the error message specified that I needed that permission, now it is much more generic - as above. The query runs as expected without scheduling.
Any help would be really appreciated!
In order to schedule queries you need to add
bigquery.datasets.update also. Since you are capable to run queries in that table you wouldn't have any further problem to achieve that.
These are the minimum permissions required to schedule queries in BigQuery. (Assuming that you have enough permissions to get tables & dataset data)

Execute Transfer in Google Bigquery - PERMISSION_DENIED: No OAuth token with Google Drive scope was found

I am trying the new 'Transfers' function in google BigQuery.
I am using the option: 'Scheduled Query'
It works with a simple query, but when I am trying another query that is normally working based on a view, that is based on a join between two tables (on table based on a google sheet shared with me) none of the more complicated Transfers I created are working.
I get the following error message:
Failed to start job for table 'xxx' with error PERMISSION_DENIED: Access Denied: BigQuery BigQuery: No OAuth token with Google Drive scope was found.
Is it because one of the source tables is based on a google sheet?
I tried to copy the source table to another table, but when I do this BigQuery automatically deletes this table.
Any ideas?
The problem is with the view which queries Google Drive data. In order to resolve your problem you need to request Google Drive scopes. Quoting directly from documentation:
Accessing data hosted within Google Drive requires an additional OAuth
scope, both when defining the federated source as well as during query
execution.
In the documentation page linked above you'll also find ways to do this via command line, api and web UI.

How do I connect a BigQuery database based on a Google Sheet to Looker?

I'm attempting to connect BigQuery to Looker. I am pulling sample data from a Google Sheets document to a BigQuery dataset; this part is working fine, as my internal BigQuery queries are running just fine for this dataset. Using this documentation from the Looker forums, I tried to create a service account key to connect my BigQuery dataset to Looker. Unfortunately, the documentation is slightly out of date: Google now asks which service account (compute engine default service account, app engine default service account, or a new service account that can have any of multiple roles) you want to attach the key to.
Thus far, I have tried using P12 keys created for the compute engine default service account, the app engine default service account, as well as a new Project Owner service account. When I create the connection in Looker, the admin page confirms that the connection "can connect, can cancel queries, can run simple select query" (I need it to do more complex things, but am just trying to connect at all right now). Using the SQL Runner to test a simple select 10 query out, I was able to query the public datasets, e.g. hacker_news or usa_names. However, whenever I tried to run the same query on my personal sample dataset, I received this error:
Failed to retrieve data - The job encountered an internal error during execution and was unable to complete successfully.
The permissions for the base Google Sheet that the BigQuery project is pulling from are set to be viewable by my coworkers who have the link. I have also been adding each service account I test as an editor (which I assume has the highest permissions). At this point, I am creating new service accounts with each of the different possible roles to see if it's a permissions issue from the role perspective. Nothing has worked so far, so any insight would be helpful!
UPDATE: I have created a new table within the same BigQuery dataset. The new table was created using a CSV file, which was simply a download of my previous table in Google Sheets. I updated the connection to Looker. When I wrote a select 10 query pulling from the new table, it worked fine and ran very quickly. This seems to imply that the problem is something about the permissions between Google Sheets and Google BigQuery.
I've been wanting to do something like this myself for a bit, saw this question, and decided to dig in.
First thing I found was this "documentation" over in the looker discourse:
https://discourse.looker.com/t/live-spreadsheets-in-databases/2698/7
In there, it describes the steps necessary to get this working.
Two important things that you are probably missing, based on your description of events so far (since it sounds like you've already attached the sheet to your dataset and are able to query it from the BigQuery UI):
Make sure you share the Google Sheet with the service account you are using to connect Looker to BigQuery. This is the Username from the Connections tab of the Admin page in Looker.
Make sure you have enabled the Drive and Sheets APIs for your google project. You can do that via The API Library. Just search for "Drive" (or "Sheets"), click on the name, and then click on the "Enable" button from the API detail page.
Once I did the above, I had to wait a few minutes before things started working. I'll go out on a limb and guess that this was because Looker needed to cycle it's internal connection pool before the permissions would reset and work. So you may need to run a few failing queries, or wait out the connection pool before this will go into effect.
Hope that helps.

M-Lab Table Access from BigQuery Not Working

I'm trying to access the M-Lab tables from BigQuery but keep getting this message:
Error: Access Denied: Table measurement-lab:m_lab.2010_01: QUERY_TABLE
I can access the other sample tables just fine.
Any suggestions?
Access to the M-lab tables requires you to be on the M-lab project as at least a 'reader'. Do you know if you've been added? I will contact the M-lab folks at Google to see if they're willing to add all users to the acl, which means that anyone will be able to access.