You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "colemandsmith (via GitHub)" <gi...@apache.org> on 2026/05/14 22:50:36 UTC
[I] BigQuery: get_time_partition_column uses 2-part table reference, causing 404 for cross-project datasets [superset]
colemandsmith opened a new issue, #40131:
URL: https://github.com/apache/superset/issues/40131
### Bug description
[This line](https://github.com/apache/superset/blob/c83fb2bb1dcfac41ac51bcebd82471f4a7180d18/superset/db_engine_specs/bigquery.py#L419) in the bigquery engine spec uses a two-part table name for the bigquery table. Because a project is not provided, the default Bigquery connector will default to the client's default project.
To reproduce:
- Run the docker image for superset 6.1.0 and connect to it from the web browser
- Create a BigQuery data connection where the BigQuery project is different than the source credentials. The credentials must have access to the dataset of interest in the BigQuery project.
- Test connection, verify it works
- Go to the `Datasets` tab and click the `+ Dataset` button
- Select the new BigQuery connection as the database, and select a schema the client has access to.
- Select a table the client has access to. An error message appears noting something went wrong trying to populate columns for the table.
Superset server logs then show the following message:
```
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "/app/.venv/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/app/.venv/lib/python3.10/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
return f(self, *args, **kwargs)
File "/app/superset/views/base_api.py", line 120, in wraps
duration, response = time_function(f, self, *args, **kwargs)
File "/app/superset/utils/core.py", line 1559, in time_function
response = func(*args, **kwargs)
File "/app/superset/utils/log.py", line 301, in wrapper
value = f(*args, **kwargs)
File "/app/superset/databases/api.py", line 1090, in table_metadata
payload = database.db_engine_spec.get_table_metadata(database, table)
File "/app/superset/db_engine_specs/base.py", line 1320, in get_table_metadata
return get_table_metadata(database, table)
File "/app/superset/databases/utils.py", line 100, in get_table_metadata
"selectStar": database.select_star(
File "/app/superset/models/core.py", line 836, in select_star
return self.db_engine_spec.select_star(
File "/app/superset/db_engine_specs/bigquery.py", line 840, in select_star
return super().select_star(
File "/app/superset/db_engine_specs/base.py", line 1936, in select_star
partition_query = cls.where_latest_partition(
File "/app/superset/db_engine_specs/bigquery.py", line 357, in where_latest_partition
if partition_column := cls.get_time_partition_column(database, table):
File "/app/superset/db_engine_specs/bigquery.py", line 424, in get_time_partition_column
bq_table = client.get_table(table_ref)
File "/app/.venv/lib/python3.10/site-packages/google/cloud/bigquery/client.py", line 1210, in get_table
api_response = self._call_api(
File "/app/.venv/lib/python3.10/site-packages/google/cloud/bigquery/client.py", line 861, in _call_api
return call()
File "/app/.venv/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py", line 294, in retry_wrapped_func
return retry_target(
File "/app/.venv/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py", line 156, in retry_target
next_sleep = _retry_error_helper(
File "/app/.venv/lib/python3.10/site-packages/google/api_core/retry/retry_base.py", line 216, in _retry_error_helper
raise final_exc from source_exc
File "/app/.venv/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py", line 147, in retry_target
result = target()
File "/app/.venv/lib/python3.10/site-packages/google/cloud/_http/__init__.py", line 494, in api_request
raise exceptions.from_http_response(response)
google.api_core.exceptions.NotFound: 404 GET https://bigquery.googleapis.com/bigquery/v2/projects/{CLIENT_PROJECT_ID}/datasets/{CROSS_PROJECT_DATASET}/tables/{CROSS_PROJECT_TABLE}?prettyPrint=false: Not found: Dataset {CLIENT_PROJECT_ID}:{CROSS_PROJECT_DATASET}
```
where CLIENT_PROJECT_ID is the project ID of the client credentials, and the CROSS_PROJECT_* fields refer to a dataset and table in a separate project that the client has access to. Since it's trying to find the dataset name from a separate project in the client's project, it 404s.
Expected behavior:
- Dataset creation does not error out when using a database referencing a different project than the source credentials' project
Encountered in the 6.1.0 release, though unlikely new.
### Screenshots/recordings
_No response_
### Superset version
master / latest-dev
### Python version
3.11
### Node version
18 or greater
### Browser
Chrome
### Additional context
Superset server logs show the following message:
```
Traceback (most recent call last):
File "/app/.venv/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
File "/app/.venv/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "/app/.venv/lib/python3.10/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
return f(self, *args, **kwargs)
File "/app/superset/views/base_api.py", line 120, in wraps
duration, response = time_function(f, self, *args, **kwargs)
File "/app/superset/utils/core.py", line 1559, in time_function
response = func(*args, **kwargs)
File "/app/superset/utils/log.py", line 301, in wrapper
value = f(*args, **kwargs)
File "/app/superset/databases/api.py", line 1090, in table_metadata
payload = database.db_engine_spec.get_table_metadata(database, table)
File "/app/superset/db_engine_specs/base.py", line 1320, in get_table_metadata
return get_table_metadata(database, table)
File "/app/superset/databases/utils.py", line 100, in get_table_metadata
"selectStar": database.select_star(
File "/app/superset/models/core.py", line 836, in select_star
return self.db_engine_spec.select_star(
File "/app/superset/db_engine_specs/bigquery.py", line 840, in select_star
return super().select_star(
File "/app/superset/db_engine_specs/base.py", line 1936, in select_star
partition_query = cls.where_latest_partition(
File "/app/superset/db_engine_specs/bigquery.py", line 357, in where_latest_partition
if partition_column := cls.get_time_partition_column(database, table):
File "/app/superset/db_engine_specs/bigquery.py", line 424, in get_time_partition_column
bq_table = client.get_table(table_ref)
File "/app/.venv/lib/python3.10/site-packages/google/cloud/bigquery/client.py", line 1210, in get_table
api_response = self._call_api(
File "/app/.venv/lib/python3.10/site-packages/google/cloud/bigquery/client.py", line 861, in _call_api
return call()
File "/app/.venv/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py", line 294, in retry_wrapped_func
return retry_target(
File "/app/.venv/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py", line 156, in retry_target
next_sleep = _retry_error_helper(
File "/app/.venv/lib/python3.10/site-packages/google/api_core/retry/retry_base.py", line 216, in _retry_error_helper
raise final_exc from source_exc
File "/app/.venv/lib/python3.10/site-packages/google/api_core/retry/retry_unary.py", line 147, in retry_target
result = target()
File "/app/.venv/lib/python3.10/site-packages/google/cloud/_http/__init__.py", line 494, in api_request
raise exceptions.from_http_response(response)
google.api_core.exceptions.NotFound: 404 GET https://bigquery.googleapis.com/bigquery/v2/projects/{CLIENT_PROJECT_ID}/datasets/{CROSS_PROJECT_DATASET}/tables/{CROSS_PROJECT_TABLE}?prettyPrint=false: Not found: Dataset {CLIENT_PROJECT_ID}:{CROSS_PROJECT_DATASET}
```
where CLIENT_PROJECT_ID is the project ID of the client credentials, and the CROSS_PROJECT_* fields refer to a dataset and table in a separate project that the client has access to.
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] BigQuery: get_time_partition_column uses 2-part table reference, causing 404 for cross-project datasets [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #40131: BigQuery: get_time_partition_column uses 2-part table reference, causing 404 for cross-project datasets
URL: https://github.com/apache/superset/issues/40131
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] BigQuery: get_time_partition_column uses 2-part table reference, causing 404 for cross-project datasets [superset]
Posted by "puneetdixit200 (via GitHub)" <gi...@apache.org>.
puneetdixit200 commented on issue #40131:
URL: https://github.com/apache/superset/issues/40131#issuecomment-4473005023
/assign
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] BigQuery: get_time_partition_column uses 2-part table reference, causing 404 for cross-project datasets [superset]
Posted by "puneetdixit200 (via GitHub)" <gi...@apache.org>.
puneetdixit200 commented on issue #40131:
URL: https://github.com/apache/superset/issues/40131#issuecomment-4467952034
I’d like to work on this. I can reproduce the cross-project BigQuery table reference failure, add coverage for 3-part table names, and patch get_time_partition_column to include the project correctly. Please assign this to me.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] BigQuery: get_time_partition_column uses 2-part table reference, causing 404 for cross-project datasets [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #40131:
URL: https://github.com/apache/superset/issues/40131#issuecomment-4455388474
<!-- Greeting -->
Hi @colemandsmith! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team.
<!-- Answer -->
This is a confirmed bug. The issue is in `get_time_partition_column` at [line 365](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/bigquery.py#L365) where the table reference is constructed as a 2-part string:
```python
bq_table = client.get_table(f"{table.schema}.{table.table}")
```
This omits `table.catalog` (which maps to the BigQuery project ID), so the client falls back to the credentials' default project — causing the 404 for cross-project datasets.
Other methods in the same file handle this correctly. For example, `df_to_sql` uses the full 3-part reference via `str(table)` [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/bigquery.py#L453), and `get_max_partition_id` constructs a qualified path including the catalog when present [[2]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/bigquery.py#L324).
The fix would be to include the catalog in the table reference when available:
```python
table_ref = (
f"{table.catalog}.{table.schema}.{table.table}"
if table.catalog
else f"{table.schema}.{table.table}"
)
bq_table = client.get_table(table_ref)
```
A related cross-project issue was previously addressed in PR #34360 for SQLAlchemy table construction [[3]](https://github.com/apache/superset/pull/34360), but that fix didn't cover this specific BigQuery client API call path. A maintainer-suggested workaround in the meantime is to create a virtual dataset with a fully-qualified table reference [[4]](https://github.com/apache/superset/issues/33465):
```sql
SELECT `col` FROM `projectId`.`dataset`.`table_name`
```
though this has the downside of Superset running predicates as subqueries.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).*
---
Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fsuperset).
[](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=664049f0-fb2e-487d-bea0-803ba18effb2) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] BigQuery: get_time_partition_column uses 2-part table reference, causing 404 for cross-project datasets [superset]
Posted by "venkatamandavilli-code (via GitHub)" <gi...@apache.org>.
venkatamandavilli-code commented on issue #40131:
URL: https://github.com/apache/superset/issues/40131#issuecomment-4471296669
Thanks for reporting this issue. The problem description makes sense, especially for cross-project BigQuery environments where fully qualified dataset references are required.
It looks like the current implementation may assume a two-part table reference (`dataset.table`) instead of handling the full three-part structure (`project.dataset.table`). In multi-project deployments, that can easily lead to lookup failures or 404 responses when metadata APIs attempt to resolve partition information.
It may help to validate:
* how table identifiers are parsed before calling `get_time_partition_column`
* whether the connector consistently preserves project-level context during metadata resolution
* whether quoted identifiers or custom schemas behave differently across environments
A regression test covering cross-project dataset references would probably help prevent similar issues in future BigQuery connector updates.
Thanks again for documenting the issue clearly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org