Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/permifrost/snowflake_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 16 additions & 1 deletion tests/permifrost/test_snowflake_connector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import logging
import os
import warnings

import pytest
import sqlalchemy
Expand Down Expand Up @@ -91,7 +93,9 @@ def test_snowflaky(self):
== 'database_1."1_LEADING_DIGIT".<table>'
)

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)

Expand All @@ -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"
Expand Down
Loading