Repository navigation
feat(bigquery): add column data policies to SchemaField - #18710
Open
AliAbouelazm wants to merge 2 commits into
Open
AliAbouelazm wants to merge 2 commits into
AliAbouelazm wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for column-level data policies in BigQuery schemas by adding a data_policies property to SchemaField, along with documentation and comprehensive unit tests. The review feedback suggests two key improvements: adding a type check to prevent strings or bytes from being silently iterated character-by-character when passed to data_policies, and replacing fragile index slicing ([:-1]) in the __repr__ method with dynamic filtering based on the named tuple's fields to ensure future-proof code.
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.
Adds data_policies to SchemaField so callers can read and set column data policy names without using _properties. Names are serialized as dataPolicies entries, and equality and hashing account for them regardless of order.
The tests cover unset, null, empty, multiple and nested policies, API round trips, repr, and schemas that use policy tags on other columns. The usage guide explains the API representation and the limits around removing the last policy and dataPolicyList precedence.
Validation on Python 3.12: 2,859 unit tests passed, 2 skipped. Black, flake8, mypy and the documentation build passed. The test process used default OpenTelemetry sampling because the inherited setting caused the same seven failures on unmodified main.
Fixes #17617.