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).
   
   [![Leave Feedback](https://img.shields.io/badge/Leave%20Feedback-555555?style=flat)](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) [![Learn about superset with Dosu](https://img.shields.io/badge/Learn%20about%20superset%20with%20Dosu-2f7b3f?style=flat&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iODYiIGhlaWdodD0iODkiIHZpZXdCb3g9IjAgMCA4NiA4OSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNS4yOTIzNiAxMi43OTI4TDE3Ljc1OTMgNi42ODE4OFY3Mi41NjY3TDUuMjkyMzYgODQuMDYxOFYxMi43OTI4WiIgZmlsbD0iI0I0QkI5MSIvPjxwYXRoIGQ9Ik0xOC4yNTc1IDczLjExOTZMNTkuMTMyOSA3Mi43NDhMNTEuNzAxMSA4Mi40MDk1TDI5LjAzMzggODYuMjkxTDYuMjM5NjIgODUuMTU1NEwxOC4yNTc1IDczLjExOTZaIiBmaWxsPSIjNzc4NTYxIi8%2BPHBhdGggZD0iTTE3LjQ5MTYgMy43MzYzM0wzLjU4NTU3IDEyLjcwOTlWODMuNTc5MkMzLjU4NTU3IDg0Ljc1NDIg
 NC45ODU2MyA4NS4zNjUyIDUuODQ3MDUgODQuNTY2TDE5LjYyOTYgNzEuNzgwMSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSI2LjQyODQ0IiBzdHJva2UtbGluZWNhcD0icm91bmQiLz48bWFzayBpZD0iZG9zdS1kLWN1dG91dCIgZmlsbD0id2hpdGUiPjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNDAuNzA0IDAuNTE4MDY2SDE3LjA0MzlWNzYuMjIyMUg0MC43MDRINDIuNTgwNUg0Ny44MDEzQzY4LjcwNjQgNzYu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20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [![Add Dosu to your team](https://img.shields.io/badge/Add%20Dosu%20to%20your%20team-1f6feb?style=flat)](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