diff --git a/src/permifrost/snowflake_connector.py b/src/permifrost/snowflake_connector.py index 77d446b9..5e7a7a3c 100644 --- a/src/permifrost/snowflake_connector.py +++ b/src/permifrost/snowflake_connector.py @@ -380,9 +380,9 @@ def snowflaky(name: str) -> str: # We do not currently support identifiers that include periods (i.e. db_1.schema_1."table.with.period") if len(name_parts) > 3: - warnings.warn( - f"Unsupported object identifier: {name} contains additional periods within identifier.", - SyntaxWarning, + logger.debug( + "Unsupported object identifier: %s contains additional periods within identifier.", + name, ) if len(name_parts) == 0: diff --git a/tests/permifrost/test_snowflake_connector.py b/tests/permifrost/test_snowflake_connector.py index 3c5a95af..a83db692 100644 --- a/tests/permifrost/test_snowflake_connector.py +++ b/tests/permifrost/test_snowflake_connector.py @@ -1,4 +1,6 @@ +import logging import os +import warnings import pytest import sqlalchemy @@ -91,7 +93,9 @@ def test_snowflaky(self): == 'database_1."1_LEADING_DIGIT".' ) - with pytest.warns(SyntaxWarning): + with warnings.catch_warnings(): + warnings.simplefilter("error") + # These identifiers have periods in them but should not raise SyntaxWarning anymore SnowflakeConnector.snowflaky(db16) SnowflakeConnector.snowflaky(db17) @@ -101,6 +105,17 @@ def test_snowflaky(self): assert SnowflakeConnector.snowflaky(db19) == "" + def test_snowflaky_logs_debug_for_period_in_identifier(self, caplog): + with caplog.at_level(logging.DEBUG, logger="permifrost.logger"): + SnowflakeConnector.snowflaky( + 'RAW_RESTRICTED.airbyte_internal."AIRBYTE_SFTP_raw__stream_2025-03-23.csv"' + ) + assert any( + "contains additional periods" in r.message + for r in caplog.records + if r.levelno == logging.DEBUG + ) + def test_uses_oauth_if_available(self, mocker, snowflake_connector_env): mocker.patch("sqlalchemy.create_engine") os.environ["PERMISSION_BOT_OAUTH_TOKEN"] = "TEST"