: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(snowflake): stop reporting known missing/unauthorized table as a bug (#73590)
Tom Owerse2f88792bfe7
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/snowflake.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/snowflake.pyindex 7ba867020813..29a307ce918e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/snowflake.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/snowflake.py@@ -539,7 +539,12 @@ class SnowflakeImplementation(table_name=table_name,exc_info=e,)- capture_exception(e)+ # The table/schema was dropped, renamed, or its grant revoked after discovery —+ # `SnowflakeSource.get_non_retryable_errors` already treats this exact phrase as+ # user/upstream and non-actionable. Reporting it here would just be noise, since the+ # pipeline already recovers via the None fallback above.+ if "does not exist or not authorized" not in str(e):+ capture_exception(e)return Nonecolumn_index = next((i for i, row in enumerate(cursor.description) if row.name == "column_name"), -1)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.pyindex 473794f124a8..0bd755eacd1d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/snowflake/tests/test_snowflake.py@@ -565,6 +565,28 @@ class TestGetPrimaryKeysForTable:cursor.execute.side_effect = Exception("does not exist or not authorized")assert impl.get_primary_keys_for_table(cursor, "DB", "PUBLIC", "t") is None+ @pytest.mark.parametrize(+ "error_msg,expect_capture",+ [+ # Table/schema dropped, renamed, or grant revoked after discovery — already classified+ # as user/upstream and non-retryable by SnowflakeSource; not worth reporting as a bug.+ (+ "002003 (42S02): 01c5ed45-0a1f-ee98-0067-5f032313bb4a: SQL compilation error:\n"+ "Table 'DB.PUBLIC.T' does not exist or not authorized.",+ False,+ ),+ # Anything else is unexpected and should still be surfaced.+ ("some other driver failure", True),+ ],+ )+ def test_captures_only_unexpected_show_failures(self, impl, cursor, error_msg, expect_capture):+ cursor.execute.side_effect = Exception(error_msg)+ with patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.snowflake.snowflake.capture_exception"+ ) as mock_capture:+ assert impl.get_primary_keys_for_table(cursor, "DB", "PUBLIC", "t") is None+ assert mock_capture.called is expect_capture+class TestGetRowsToSync:def test_returns_count(self, impl, cursor, logger):