-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Description
Bug description
Describe the bug
When configuring a BigQuery database connection in Superset using a service account, the generated SQL queries fail if the service account's project ID is different from the project ID where the target BigQuery dataset and table reside.
The BigQuery connector appears to generate table references in the format `dataset`.`table_name`
. While this works when querying tables within the same project as the service account, cross-project queries require the format `projectId`.`dataset`.`table_name`
. The missing project ID in the generated query prevents successful execution.
To Reproduce
Steps to reproduce the behavior:
- Configure a new BigQuery database connection in Superset.
- Select "Service Account" as the authentication method.
- Modify SQLAlchemy to seperate billing_project_id and project_id. It still waiting approve
- Use a service account whose project ID is
project-A
. - Add a dataset and table from a different project, say
project-B
, to Superset. - Attempt to run a query or create a chart using the table from
project-B
.
Actual behavior
The query fails with an error (likely related to permissions or table not found), because the generated SQL omits the required project ID for cross-project access, like:
SELECT `column` FROM `dataset`.`table_name`
Proposed Solution
A query that includes the project ID format works correctly:
SELECT `example` AS `example` FROM `projectId`.`dataset`.`table_name`
Environment:
Superset version:4.1.2
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- I have searched Superset docs and Slack and didn't find a solution to my problem.
- I have searched the GitHub issue tracker and didn't find a similar bug report.
- I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.