Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve exception message for unsupported Snowflake data types #4779

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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
Loading