diff --git a/DESCRIPTION.md b/DESCRIPTION.md index 99ca0e831..6b9e6a419 100644 --- a/DESCRIPTION.md +++ b/DESCRIPTION.md @@ -10,6 +10,7 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne - v3.16(TBD) - Added basic arrow support for Interval types. - Fix `write_pandas` special characters usage in the location name. + - Ensure the converter runs to_snowflake on list items. - v3.15.0(Apr 29,2025) - Bumped up min boto and botocore version to 1.24. diff --git a/src/snowflake/connector/converter.py b/src/snowflake/connector/converter.py index 820235199..fa8348226 100644 --- a/src/snowflake/connector/converter.py +++ b/src/snowflake/connector/converter.py @@ -623,8 +623,8 @@ def _decimal_to_snowflake(self, value: decimal.Decimal) -> str | None: def _list_to_snowflake(self, value: list) -> list: return [ - SnowflakeConverter.quote(v0) - for v0 in [SnowflakeConverter.escape(v) for v in value] + SnowflakeConverter.quote(SnowflakeConverter.escape(self.to_snowflake(v))) + for v in value ] _tuple_to_snowflake = _list_to_snowflake diff --git a/test/unit/test_converter.py b/test/unit/test_converter.py index 37f41172f..2e29b036c 100644 --- a/test/unit/test_converter.py +++ b/test/unit/test_converter.py @@ -4,6 +4,7 @@ from datetime import timedelta from decimal import Decimal from logging import getLogger +from uuid import UUID import numpy import pytest @@ -77,6 +78,13 @@ def test_more_timestamps(): assert m("-2208943503.0120000") == "1900-01-01 12:34:56.988000000" +def test_converter_to_snowflake_bytes(): + uuid = UUID("12345678-1234-5678-1234-567812345678") + + converter = SnowflakeConverter() + assert converter.to_snowflake([uuid.bytes]) == ["X'\x124Vx\x124Vx\x124Vx\x124Vx'"] + + def test_converter_to_snowflake_error(): converter = SnowflakeConverter() with pytest.raises(