Skip to content

Commit

Permalink
let lazy_import_transformers force load the snowflake-connector
Browse files Browse the repository at this point in the history
Signed-off-by: HH <[email protected]>
  • Loading branch information
hhcs9527 committed Sep 10, 2023
1 parent afe39bc commit c16591a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions flytekit/core/type_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,11 +854,14 @@ def lazy_import_transformers(cls):
register_arrow_handlers()
if is_imported("google.cloud.bigquery"):
register_bigquery_handlers()
if is_imported("snowflake.connector"):
register_snowflake_handlers()
if is_imported("numpy"):
from flytekit.types import numpy # noqa: F401

try:
register_snowflake_handlers()
except ValueError as e:
logger.debug(f"Attempted to register the Snowflake handler but failed due to: {str(e)}")

@classmethod
def to_literal_type(cls, python_type: Type) -> LiteralType:
"""
Expand Down
3 changes: 2 additions & 1 deletion flytekit/types/structured/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,6 @@ def register_snowflake_handlers():

except ImportError:
logger.info(
"We won't register snowflake handler for structured dataset because " "we can't find package snowflake"
"We won't register snowflake handler for structured dataset because "
"we can't find package snowflakee-connector-python"
)

0 comments on commit c16591a

Please sign in to comment.