From 4a20ab0d2a4c98fcfee3c9271eaeb038ee2ed34f Mon Sep 17 00:00:00 2001 From: Andrew Hawkins Date: Tue, 20 Aug 2024 17:00:24 -0400 Subject: [PATCH 1/2] Change how a column of type VECTOR is parsed --- dbt/adapters/snowflake/column.py | 8 ++++++++ tests/unit/test_snowflake_adapter.py | 13 +++++++++++++ 2 files changed, 21 insertions(+) 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 32e73eb45..e99d2763e 100644 --- a/tests/unit/test_snowflake_adapter.py +++ b/tests/unit/test_snowflake_adapter.py @@ -862,6 +862,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): From 2fafcfbfecbef26ceb3c11bcf3d69fcae799f322 Mon Sep 17 00:00:00 2001 From: Andrew Hawkins Date: Fri, 18 Oct 2024 17:31:50 -0400 Subject: [PATCH 2/2] Add changelog entry --- .changes/unreleased/Fixes-20241018-173123.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixes-20241018-173123.yaml 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"