Skip to content

[DRAFT] chore(bigtable): add samples for sync client - #17820

Draft
daniel-sanche wants to merge 8 commits into
samples_1_reorganize_samplesfrom
samples_2_add_sync_samples
Draft

[DRAFT] chore(bigtable): add samples for sync client#17820
daniel-sanche wants to merge 8 commits into
samples_1_reorganize_samplesfrom
samples_2_add_sync_samples

Conversation

@daniel-sanche

Copy link
Copy Markdown
Contributor

This PR covers sample gaps between the sync data client/generated admin client

TODO: review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds new Python samples and tests for the Google Cloud Bigtable admin and data clients, while updating legacy client samples with _legacy region tags. The review feedback highlights several critical API usage issues in the new data client snippets, including incorrect attribute access on Row and Cell objects, the use of the non-existent DeleteRangeFromColumn class (which should be DeleteCells), and type mismatches where regex filters expect bytes instead of strings (or vice-versa). Additionally, the feedback suggests minor cleanups for unused imports, unused variables, and redundant fully qualified imports.

Comment on lines +324 to +331
query = ReadRowsQuery(
row_filter=row_filters.RowFilterUnion(
filters=[
row_filters.ValueRegexFilter("true"),
row_filters.ColumnQualifierRegexFilter("os_build"),
]
)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

In the Python Bigtable data client, both ValueRegexFilter and ColumnQualifierRegexFilter expect bytes as their patterns because cell values and column qualifiers are stored as bytes. Passing strings will cause runtime errors or matching failures.

Suggested change
query = ReadRowsQuery(
row_filter=row_filters.RowFilterUnion(
filters=[
row_filters.ValueRegexFilter("true"),
row_filters.ColumnQualifierRegexFilter("os_build"),
]
)
)
query = ReadRowsQuery(
row_filter=row_filters.RowFilterUnion(
filters=[
row_filters.ValueRegexFilter(b"true"),
row_filters.ColumnQualifierRegexFilter(b"os_build"),
]
)
)

Comment thread packages/google-cloud-bigtable/samples/admin_client/tableadmin/tableadmin.py Outdated
Comment thread packages/google-cloud-bigtable/samples/data_client/hello/main.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant