Skip to content

Commit

Permalink
Improve exception message for unsupported Snowflake data types
Browse files Browse the repository at this point in the history
Signed-off-by: hkuepers <[email protected]>
  • Loading branch information
hkuepers committed Nov 21, 2024
1 parent 1104753 commit 45d12dc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sdk/python/feast/infra/offline_stores/snowflake_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,15 @@ def get_table_column_names_and_types(
row["snowflake_type"] = "NUMBERwSCALE"

elif row["type_code"] in [5, 9, 12]:
error = snowflake_unsupported_map[row["type_code"]]
datatype = snowflake_unsupported_map[row["type_code"]]
raise NotImplementedError(
f"The following Snowflake Data Type is not supported: {error}"
f"The datatype of column {row['column_name']} is of type {datatype} in datasource {query}. This type is not supported. Try converting to VARCHAR."
)
elif row["type_code"] in [1, 2, 3, 4, 6, 7, 8, 10, 11, 13]:
row["snowflake_type"] = snowflake_type_code_map[row["type_code"]]
else:
raise NotImplementedError(
f"The following Snowflake Column is not supported: {row['column_name']} (type_code: {row['type_code']})"
f"The datatype of column {row['column_name']} in datasource {query} is not supported."
)

return [
Expand All @@ -317,9 +317,9 @@ def get_table_column_names_and_types(
}

snowflake_unsupported_map = {
5: "VARIANT -- Try converting to VARCHAR",
9: "OBJECT -- Try converting to VARCHAR",
12: "TIME -- Try converting to VARCHAR",
5: "VARIANT",
9: "OBJECT",
12: "TIME",
}

python_int_to_snowflake_type_map = {
Expand Down

0 comments on commit 45d12dc

Please sign in to comment.