: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): recognize a renamed/dropped column as non-retryable (#78592)
Tom Owers10f9c32b0aaa
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 c8b287cb1c30..a18830cd347e 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@@ -281,6 +281,16 @@ class BigQuerySource(SQLSource[BigQuerySourceConfig]):# user must fix the view or table definition. Matched on BigQuery's stable wording, not# the volatile column name or [row:col] location."is ambiguous": "BigQuery couldn't run a query for this source because a column name in the table or view being synced is ambiguous. This usually happens when a view joins tables that share a column name, or two columns differ only by letter case. Retrying won't help — please update the view or table definition to remove the naming conflict (for example by aliasing the duplicate column), then reconnect the source.",+ # Raised as a 400 BadRequest (reason `invalidQuery`) when a query we build references a+ # column that no longer exists on the table, e.g. "Unrecognized name: ingested_at at+ # [1:37]". We only reference columns the customer configured — the incremental field, an+ # enabled column, or a row filter — so this means that column was renamed or dropped from+ # the source table after the source (or its incremental field) was set up. It's a+ # deterministic mismatch between our stored config and the customer's live schema: the+ # same query fails identically on every retry. The user must update the source's column+ # 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.",}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 6b58fed83bc1..4974ea3262cc 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@@ -755,6 +755,27 @@ def test_bigquery_ambiguous_column_is_non_retryable(observed_error):assert all(non_retryable_errors[key] is not None for key in matching)+ "observed_error",+ [+ # Incremental field (or an enabled column) renamed/dropped from the source table.+ "400 Unrecognized name: ingested_at at [1:37]; reason: invalidQuery, location: query, "+ "message: Unrecognized name: ingested_at at [1:37]\n\nLocation: europe-north1\nJob ID: "+ "f50c015b-4295-4b95-a361-2503e9c936f7\n",+ # Different column name and location — the match must not rely on either.+ "400 Unrecognized name: legacy_status at [2:10]; reason: invalidQuery, location: query, "+ "message: Unrecognized name: legacy_status at [2:10]",+ ],+)+def test_bigquery_unrecognized_column_name_is_non_retryable(observed_error):+ """A column referenced by our query (the incremental field, an enabled column, or a row+ filter) that was renamed or dropped from the source 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, "Unrecognized column name 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",[