Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigQuery: Enable Access to Google Sheets-Backed Tables #3016

Open
wants to merge 7 commits into
base: next
Choose a base branch
from

Conversation

olegam
Copy link

@olegam olegam commented Jan 16, 2025

Explicitly specify scopes for service user authentication in BigQuery datasource and include Drive scope, to fix issue when querying tables backed by a Google Sheet document

Description

BigQuery supports tables backed by a Google Sheet. In the current version of Evidence it's not possible to query those tables using Service User authentication.

$ npm run sources
✔ Loading plugins & sources
-----
  [Processing] mysouce
  config_orders ✖ Error: Unknown Error

This error is not very descriptive, but looking in the Google Cloud Console logs reveal the error:

Access Denied: BigQuery BigQuery: Permission denied while getting Drive credentials.

To fix this we need to include the https://www.googleapis.com/auth/drive scope when authenticating.

After adding these lines I'm able to load data from my Google Sheet-backed BigQuery table.

… datasource and include Drive scope, to fix issue when querying tables backed by a Google Sheet document
@olegam olegam temporarily deployed to Approval required to run action on external PR January 16, 2025 11:30 — with GitHub Actions Inactive
@olegam olegam temporarily deployed to Approval required to run action on external PR January 16, 2025 11:30 — with GitHub Actions Inactive
@olegam olegam marked this pull request as ready for review January 16, 2025 11:34
@archiewood archiewood added the needs-ci Maintainer to review and start CI label Jan 16, 2025
@zachstence
Copy link
Member

If I'm understanding correctly, this would add these scopes for everybody using the BigQuery datasource, correct? If that's the case, we probably want this to be configurable by the user in their connection.yaml.

@ItsMeBrianD thoughts?

@zachstence zachstence removed the needs-ci Maintainer to review and start CI label Jan 16, 2025
@archiewood
Copy link
Member

@zachstence I think this is a good approach.
So we'd want a field to allow people to add scopes, perhaps?

@archiewood
Copy link
Member

archiewood commented Jan 16, 2025

Okay @olegam - my suggestion here:
Add a boolean checkbox to the options which a user can check to add the scopes

  • title: "Enable Connected Sheets"
  • description: "Allows access to connected Google Sheets. Requires additional scopes: x,y,z"

relevant section in this starts

module.exports.options = {

@olegam olegam requested a deployment to Approval required to run action on external PR January 17, 2025 11:08 — with GitHub Actions Waiting
@olegam olegam requested a deployment to Approval required to run action on external PR January 17, 2025 11:08 — with GitHub Actions Waiting
@olegam
Copy link
Author

olegam commented Jan 17, 2025

Ok I added a checkmark in the configuration options to toggle the additional Drive scope as suggested by @archiewood

@archiewood archiewood requested a deployment to Approval required to run action on external PR January 17, 2025 16:12 — with GitHub Actions Waiting
@archiewood archiewood requested a deployment to Approval required to run action on external PR January 17, 2025 16:12 — with GitHub Actions Waiting
@archiewood archiewood changed the base branch from main to next January 17, 2025 16:12
@archiewood archiewood changed the title Add Drive Scope to Service User Authentication for BigQuery to Enable Access to Google Sheets-Backed Tables BigQuery: Enable Access to Google Sheets-Backed Tables Jan 17, 2025
@archiewood
Copy link
Member

archiewood commented Jan 17, 2025

I think if you merge back in next now, CI will pass - our dev branch is next so I adjusted this PR to point at it

@olegam olegam requested a deployment to Approval required to run action on external PR January 22, 2025 15:45 — with GitHub Actions Waiting
@olegam olegam requested a deployment to Approval required to run action on external PR January 22, 2025 15:45 — with GitHub Actions Waiting
@archiewood archiewood added the needs-ci Maintainer to review and start CI label Jan 22, 2025
@archiewood archiewood requested a deployment to Approval required to run action on external PR January 22, 2025 17:16 — with GitHub Actions Waiting
@archiewood archiewood requested a deployment to Approval required to run action on external PR January 22, 2025 17:16 — with GitHub Actions Waiting
@archiewood archiewood temporarily deployed to Approval required to run action on external PR January 22, 2025 17:35 — with GitHub Actions Inactive
@archiewood archiewood temporarily deployed to Approval required to run action on external PR January 22, 2025 17:35 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants