-
Notifications
You must be signed in to change notification settings - Fork 3
Fix error when retaining policy_tags with access controls in replace mode #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…lace mode Refactored the retention logic for descriptions and policy_tags to handle the case where policy_tags have access controls, which was causing errors when retain_column_policy_tags was enabled. - Moved retention logic from buildSchema to post-table-creation update - buildSchema now only defines field structure, temporarily storing retained info - Added updateTableIfNeed to update table after creation when needed - column_options description takes precedence over retained description 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
| bigquery.update( | ||
| TableInfo.newBuilder( | ||
| table.getTableId(), | ||
| StandardTableDefinition.newBuilder().setSchema(patchSchema).build()) | ||
| .build()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have an error handling for bigquery.update ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NamedPython
Thank you for the review.
Could you specify the type of exception handling you’re considering?
I believe it would fall under one of the following cases — could you please confirm?
-
Output an error log and throw a BigqueryException.
embulk-output-bigquery_java/src/main/java/org/embulk/output/bigquery_java/BigqueryClient.java
Lines 219 to 224 in 6af0ee5
logger.error( String.format("embulk-out_bigquery: insert_table(%s:%s.%s)", project, dataset, table)); throw new BigqueryException( String.format( "failed to create table %s:%s.%s, response: %s", project, dataset, table, e)); } -
Some API errors do not affect the overall process, so we will ignore those errors in such cases.
-
Output a warning log and continue the process.
-
No change needed — just let the error thrown by bigquery.update propagate as is.
For reference, in the cases of getDataset, createDataset, and deleteTableOrPartition, neither the caller nor the callee performs any specific exception handling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chikamura Thanks and sorry for delay.
I think the first one would be nice for the investigation. It's OK to throw unhandled exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review. I've fixed it. e94ebd8
NamedPython
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left one comment 🙏🏻
Add try-catch block to log error and throw BigqueryException when bigquery.update fails, consistent with createTableIfNotExist method. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
NamedPython
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
Summary
Background
When
retain_column_policy_tagswas enabled in replace mode and the existing table had policy_tags with accesscontrols, the operation would fail. This was because trying to set policy_tags with access controls during table
creation is not allowed by BigQuery.
Changes
buildSchemato a post-creation update processupdateTableIfNeedmethod to update table schema after creationstoreCachedSrcFieldsIfNeedto temporarily store source fields