Skip to content

feat(bigquery): classify common BigQuery errors - #4773

Open
dtunikov wants to merge 20 commits into
mainfrom
codex/classify-common-bigquery-errors
Open

feat(bigquery): classify common BigQuery errors#4773
dtunikov wants to merge 20 commits into
mainfrom
codex/classify-common-bigquery-errors

Conversation

@dtunikov

@dtunikov dtunikov commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • classify BigQuery errors by structured API reason before HTTP status
  • retry transient backend, rate-limit, stopped-job, and table-unavailable failures
  • notify users about access, quota, invalid-query, resource, and other actionable failures
  • add HTTP status fallbacks for errors without structured reasons
  • emulate raw BigQuery REST responses through googleapi.CheckResponse in tests

dtunikov and others added 17 commits September 4, 2026 11:36
- use native bigquery.FieldType in pkg ColumnInfo
Tables without a primary key constraint have TableConstraints == nil,
which panicked on tableMeta.TableConstraints.PrimaryKey.Columns.
Adding BIGQUERY_REPLICATION_MODE_UNSPECIFIED = 0 (and
BIGQUERY_CDC_EVENTS_FUNCTION_UNSPECIFIED = 0) moved EVENTS and APPENDS
off the proto zero value, so Test_BigQuery_Source_CDC_Validation's base
config, which relied on those defaults, started tripping the new
"invalid replication mode" guard in ValidateMirrorSource.

Set the replication mode and CDC events function explicitly on the base
config, restore it (rather than nil) after the QUERY subtest, and cover
the unspecified-mode rejection directly.

Also reject an unset replication mode in ValidateSourceCDC. The flow
connector already guards it, but the pkg is meant to be callable from
outside the flow module, and there it silently skipped every CDC check.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The regenerated TableMapping interface has a required watermarkColumn
field, and TableMapRow derives from it, so both table-mapping object
literals in the mirror create handlers stopped type checking. Pass the
row's value through in reformattedTableMapping and default it to empty
when building rows from the source schema; there is no UI control for it
yet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dtunikov
dtunikov force-pushed the bq/watermark-column-replication branch from 9955a78 to 183fbdc Compare September 4, 2026 09:36
@dtunikov dtunikov changed the title Classify common BigQuery errors WIP feat(bigquery): classify common BigQuery errors Sep 4, 2026
@dtunikov
dtunikov force-pushed the codex/classify-common-bigquery-errors branch from 7f8bb0a to 885ace4 Compare September 4, 2026 11:40
@dtunikov
dtunikov marked this pull request as ready for review September 8, 2026 12:33
@dtunikov
dtunikov requested a review from a team as a code owner September 8, 2026 12:33
@dtunikov dtunikov changed the title WIP feat(bigquery): classify common BigQuery errors feat(bigquery): classify common BigQuery errors Sep 8, 2026
@claude

claude Bot commented Sep 8, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Comment on lines +362 to +377
case "attributeError",
"badRequest",
"billingNotEnabled",
"billingTierLimitExceeded",
"blocked",
"duplicate",
"invalid",
"invalidQuery",
"notImplemented",
"quotaExceeded",
"resourceInUse",
"resourcesExceeded",
"responseTooLarge",
"stopped",
"timeout":
return ErrorNotifyBigQueryError, true

@jgao54 jgao54 Sep 8, 2026

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.

nit: classifying errors upfront have the benefit of less noisy alert; the trade-off here is that some of these errors (e.g. invalidQuery) may actually surface implementation issues that we otherwise don't get alerted if it is something on our end that could be fixed, so could be informative for new connectors. Since you have a better grasp of errors in BQ will leave this to your decision on this trade-offs here and which errors to classify upfront vs. later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah..
i'll double check these errors and exclude those that can be added after some monitoring in prod

Base automatically changed from bq/watermark-column-replication to main September 9, 2026 14:31
@dtunikov
dtunikov requested a review from a team as a code owner September 9, 2026 14:31
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.

2 participants