diff --git a/.changes/unreleased/Fixes-20241018-173123.yaml b/.changes/unreleased/Fixes-20241018-173123.yaml new file mode 100644 index 000000000..eab4e8376 --- /dev/null +++ b/.changes/unreleased/Fixes-20241018-173123.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Fix parsing of the VECTOR type +time: 2024-10-18T17:31:23.931299-04:00 +custom: + Author: achawkins + Issue: "1098" diff --git a/dbt/adapters/snowflake/column.py b/dbt/adapters/snowflake/column.py index de92a051f..281831b29 100644 --- a/dbt/adapters/snowflake/column.py +++ b/dbt/adapters/snowflake/column.py @@ -41,3 +41,11 @@ def string_size(self) -> int: return 16777216 else: return int(self.char_size) + + @classmethod + def from_description(cls, name: str, raw_data_type: str) -> "SnowflakeColumn": + if "vector" in raw_data_type.lower(): + column = cls(name, raw_data_type, None, None, None) + else: + column = super().from_description(name, raw_data_type) + return column diff --git a/tests/unit/test_snowflake_adapter.py b/tests/unit/test_snowflake_adapter.py index aa580aad2..18a5310dc 100644 --- a/tests/unit/test_snowflake_adapter.py +++ b/tests/unit/test_snowflake_adapter.py @@ -863,6 +863,19 @@ def test_float_from_description(self): assert col.is_string() is False assert col.is_integer() is False + def test_vector_from_description(self): + col = SnowflakeColumn.from_description("my_col", "VECTOR(FLOAT, 768)") + assert col.column == "my_col" + assert col.dtype == "VECTOR(FLOAT, 768)" + assert col.char_size is None + assert col.numeric_precision is None + assert col.numeric_scale is None + assert col.is_float() is False + assert col.is_number() is False + assert col.is_numeric() is False + assert col.is_string() is False + assert col.is_integer() is False + class SnowflakeConnectionsTest(unittest.TestCase): def test_comment_stripping_regex(self):