Skip to content

fix(bigquery): preserve catalog in partition metadata lookup#40200

Open
puneetdixit200 wants to merge 1 commit into
apache:masterfrom
puneetdixit200:fix/bigquery-partition-cross-project
Open

fix(bigquery): preserve catalog in partition metadata lookup#40200
puneetdixit200 wants to merge 1 commit into
apache:masterfrom
puneetdixit200:fix/bigquery-partition-cross-project

Conversation

@puneetdixit200
Copy link
Copy Markdown

SUMMARY

Preserve the BigQuery project/catalog when looking up time partition metadata.

get_time_partition_column previously called client.get_table() with only dataset.table, so the BigQuery client
could fall back to the credentials/default project and return a 404 for cross-project datasets. The lookup now uses
project.dataset.table when Table.catalog is available.

Fixes #40131

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable.

TESTING INSTRUCTIONS

Automated checks:

  • venv\Scripts\python.exe -m pytest tests\unit_tests\db_engine_specs\test_bigquery.py -q
  • venv\Scripts\python.exe -m ruff format --check superset\db_engine_specs\bigquery.py tests\unit_tests\db_engine_specs\test_bigquery.py
  • venv\Scripts\python.exe -m ruff check superset\db_engine_specs\bigquery.py tests\unit_tests\db_engine_specs\test_bigquery.py
  • git diff --check

Manual verification:

  1. Configure a BigQuery database where the credentials project differs from the dataset project.
  2. Select a schema/dataset from the dataset project.
  3. Open metadata for a time-partitioned table.
  4. Confirm metadata loads without a 404 from the credentials/default project.

ADDITIONAL INFORMATION

Copilot AI review requested due to automatic review settings May 18, 2026 01:03
@dosubot dosubot Bot added the data:connect:googlebigquery Related to BigQuery label May 18, 2026
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented May 18, 2026

Code Review Agent Run #49e3b4

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 4c5a6ac..4c5a6ac
    • superset/db_engine_specs/bigquery.py
    • tests/unit_tests/db_engine_specs/test_bigquery.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes BigQuery partition column lookup to include the project (catalog) in the fully-qualified table reference, ensuring partition metadata is retrieved from the correct project rather than the connection's default.

Changes:

  • Prepend table.catalog to the BigQuery table reference passed to client.get_table when available.
  • Add a unit test verifying the catalog is included in the table reference.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
superset/db_engine_specs/bigquery.py Build table reference as catalog.schema.table when catalog is present.
tests/unit_tests/db_engine_specs/test_bigquery.py New test asserting catalog-qualified table reference is used.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.16%. Comparing base (b09ef7a) to head (4c5a6ac).
⚠️ Report is 35 commits behind head on master.

Files with missing lines Patch % Lines
superset/db_engine_specs/bigquery.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40200      +/-   ##
==========================================
- Coverage   64.16%   64.16%   -0.01%     
==========================================
  Files        2591     2591              
  Lines      138162   138165       +3     
  Branches    32048    32049       +1     
==========================================
  Hits        88649    88649              
- Misses      47984    47987       +3     
  Partials     1529     1529              
Flag Coverage Δ
hive 39.45% <0.00%> (-0.01%) ⬇️
mysql 59.15% <0.00%> (-0.01%) ⬇️
postgres 59.23% <0.00%> (-0.01%) ⬇️
presto 41.14% <0.00%> (-0.01%) ⬇️
python 60.67% <0.00%> (-0.01%) ⬇️
sqlite 58.87% <0.00%> (-0.01%) ⬇️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BigQuery: get_time_partition_column uses 2-part table reference, causing 404 for cross-project datasets

2 participants