Repository navigation
fix: Place PRIMARY KEY inside the column list in BigQuery monitoring DDL - #7021
Open
liron-velocity wants to merge 1 commit into
Open
liron-velocity wants to merge 1 commit into
liron-velocity wants to merge 1 commit into
Conversation
BigQuery only accepts table constraints inside the table element list. The four data quality monitoring CREATE TABLE statements put `PRIMARY KEY (...) NOT ENFORCED` after the closing parenthesis, which BigQuery rejects at parse time, so monitoring failed on every BigQuery deployment. Move each constraint inside its column list and add a unit test that checks the generated DDL. Fixes feast-dev#7020 Signed-off-by: liron-velocity <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7021 +/- ##
==========================================
+ Coverage 50.94% 50.96% +0.01%
==========================================
Files 455 455
Lines 56915 56915
Branches 8290 8290
==========================================
+ Hits 28994 29005 +11
+ Misses 25940 25928 -12
- Partials 1981 1982 +1
*This pull request uses carry forward flags. Click here to find out more.
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
_bq_ensure_monitoring_tablesputsPRIMARY KEY (...) NOT ENFORCEDafter the closing parenthesis of the column list in all four data quality monitoringCREATE TABLE IF NOT EXISTSstatements. GoogleSQL only accepts table constraints inside the table element list (( column | constraint_definition [, ...] )), so BigQuery rejects each statement at parse time:As a result, BigQuery monitoring (
feast monitor run, the/monitoringREST endpoints, andauto_baselineonfeast apply) fails on every BigQuery deployment. This has been the case since v0.64.0.This PR:
PRIMARY KEY (...) NOT ENFORCEDinside its column list, after a trailing comma on the last column. The key columns are unchanged, and nothing else in the file changes.test_ensure_monitoring_tables_primary_key_inside_column_listtosdk/python/tests/unit/infra/offline_stores/test_bigquery.py. It patches_get_bigquery_client, captures the DDL sent toclient.query, and asserts two things: all four monitoring tables are created, and in eachCREATE TABLEthePRIMARY KEY ... NOT ENFORCEDclause sits inside the outermost parentheses, with nothing after the final). Until now, no test covered this function: the monitoring integration test mocksensure_monitoring_tables.The other offline stores (Redshift, Snowflake, Postgres, Oracle) already put the constraint inside the element list, so only BigQuery needed the fix.
Which issue(s) this PR fixes:
Fixes #7020
Checks
git commit -s)Testing Strategy
Unit test, before and after the fix (
pytest sdk/python/tests/unit/infra/offline_stores/test_bigquery.py):1 failed, 16 passed. The new test fails because thefeast_monitoring_feature_metricsDDL ends with... NOT ENFORCEDinstead of).17 passedLint:
ruff check,ruff format --check(ruff 0.16.10, the pinned CI version) onsdk/python/feast/andsdk/python/tests/, andmypyon both changed files. All clean.Manual: a BigQuery dry run confirms the parser behavior, and the result doesn't depend on location:
Misc
🤖 Generated with Claude Code