:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(bigquery): treat missing selected fields as non-retryable (#80076)
Tom Owers081be6c741ae
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/source.pyindex c8a7a5586936..22fa47f6425c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/source.py@@ -313,6 +313,16 @@ class BigQuerySource(SQLSource[BigQuerySourceConfig]):# selection or incremental field to match the table's current schema. Matched on# BigQuery's stable wording, not the volatile column name or [row:col] location."Unrecognized name:": "BigQuery couldn't run a query for this source because it referenced a column that no longer exists on the table — usually the configured incremental field, or a column selected for syncing, was renamed or removed. Retrying won't help — please update the source's column selection or incremental field to match the table's current schema, then reconnect the source.",+ # Raised from the Storage Read API's `create_read_session` (see `get_rows` in+ # `bigquery.py`) when a column selected for syncing no longer exists on the live table —+ # the direct-read counterpart of "Unrecognized name:" above, which covers the same drift+ # on the query-job path (incremental / view / row-filtered reads). The google.api_core+ # InvalidArgument stringifies as "request failed: The following selected fields do not+ # exist in the table schema: <col1>, <col2>, ...". It's a deterministic mismatch between+ # our stored config and the customer's live schema: the same read fails identically on+ # every retry. The user must update the source's column selection to match the table's+ # current schema. Matched on the stable wording, not the volatile list of column names.+ "do not exist in the table schema": "BigQuery couldn't read this table because it referenced columns that no longer exist on it — usually columns selected for syncing were renamed or removed. Retrying won't help — please update the source's column selection to match the table's current schema, then reconnect the source.",}def validate_credentials(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/tests/test_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/tests/test_source.pyindex 988cc29637ef..2ad248fe5486 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/tests/test_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/bigquery/tests/test_source.py@@ -800,6 +800,24 @@ def test_bigquery_unrecognized_column_name_is_non_retryable(observed_error):assert all(non_retryable_errors[key] is not None for key in matching)+ "observed_error",+ [+ # A single enabled column renamed/dropped from the source table (direct-read path).+ "request failed: The following selected fields do not exist in the table schema: FOO",+ # Multiple columns — the match must not rely on the specific field names or their count.+ "request failed: The following selected fields do not exist in the table schema: FOO, BAR, BAZ",+ ],+)+def test_bigquery_missing_selected_fields_is_non_retryable(observed_error):+ """A column selected for syncing via the Storage Read API's direct-read path that was renamed+ or dropped from the live table makes every retry fail identically."""+ non_retryable_errors = BigQuerySource().get_non_retryable_errors()+ matching = [key for key in non_retryable_errors if key in observed_error]+ assert matching, "Missing selected-fields error should be recognised as non-retryable"+ assert all(non_retryable_errors[key] is not None for key in matching)++@pytest.mark.parametrize("transient_error",[