GitHub user esgungor closed a discussion: Missing Project ID on BigQuery


**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:
1. Configure a new BigQuery database connection in Superset.
2. Select "Service Account" as the authentication method.
3. Modify SQLAlchemy to seperate billing_project_id and project_id. It still 
waiting 
[approve](https://github.com/googleapis/python-bigquery-sqlalchemy/pull/1180) 
4. Use a service account whose project ID is `project-A`.
5. Add a dataset and table from a *different* project, say `project-B`, to 
Superset.
6. 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:

```sql
SELECT `column` FROM `dataset`.`table_name`
```
**Proposed Solution**
A query that includes the project ID format works correctly:
```sql
 SELECT `example` AS `example` FROM `projectId`.`dataset`.`table_name`
```

Environment:

Superset version:4.1.2


GitHub link: https://github.com/apache/superset/discussions/33464

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to