When trying the access a federated source (Google sheets) from BigQuery API, the following error is thrown:
[..]
"errorResult" : {
"location" : "/gdrive/id/<removed_file_id>",
"message" : "Encountered an error while globbing file pattern.",
"reason" : "invalid"
}
[..]
The table in BigQuery is set up to point to this file. It works via the Web UI. It is only when trying to query the table through the API does it then choke with the error above.
I'm guessing it has something to do with permissions. What needs to be done to allow accessing a BigQuery table from the API which is a federated source (pointing to Google Sheets)?
Stay organized with collections Save and categorize content based on your preferences. A data platform for customers to create, manage, share and query data.
Open the BigQuery page in the Google Cloud console. In the Explorer panel, expand your project and dataset, then select the table. In the details panel, click Export and select Export to Cloud Storage.
BigQuery is a fully managed enterprise data warehouse that helps you manage and analyze your data with built-in features like machine learning, geospatial analysis, and business intelligence.
There are 3 steps to follow when allowing the API to query a federated table in BigQuery - which is pointing to a file in Drive i.e. Google Sheets.
Two of the steps are documented here (I was missing the 2nd one - adding the Drive scope). The last one is the add the associated service account email that is being used to access the API to the file itself.
<project-id>-<fingerprint-hash>@developer.gserviceaccount.com
. "View" permission is enough.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With