Skip to content

Commit

Permalink
fix: Remove PySpark dependency from Snowflake Offline Store (#3388)
Browse files Browse the repository at this point in the history
* fix: Wrap pyspark import in try except for snowflake offline store

Signed-off-by: Ryan Beauchamp <[email protected]>

* fix: Capture exception

Signed-off-by: Ryan Beauchamp <[email protected]>

* fix: update jinja template

Signed-off-by: Ryan Beauchamp <[email protected]>

* lint

Signed-off-by: Danny Chiao <[email protected]>

Signed-off-by: Ryan Beauchamp <[email protected]>
Signed-off-by: Danny Chiao <[email protected]>
Co-authored-by: Danny Chiao <[email protected]>
  • Loading branch information
beauchbum and adchia authored Dec 14, 2022
1 parent 8090e2a commit 7b160c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion infra/templates/README.md.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pip install feast
### 2. Create a feature repository
```commandline
feast init my_feature_repo
cd my_feature_repo
cd my_feature_repo/feature_repo
```

### 3. Register your feature definitions and set up your feature store
Expand Down
8 changes: 7 additions & 1 deletion sdk/python/feast/infra/offline_stores/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import pyarrow
from pydantic import Field, StrictStr
from pydantic.typing import Literal
from pyspark.sql import DataFrame, SparkSession
from pytz import utc

from feast import OnDemandFeatureView
Expand Down Expand Up @@ -64,6 +63,13 @@

raise FeastExtrasDependencyImportError("snowflake", str(e))

try:
from pyspark.sql import DataFrame, SparkSession
except ImportError as e:
from feast.errors import FeastExtrasDependencyImportError

raise FeastExtrasDependencyImportError("spark", str(e))

warnings.filterwarnings("ignore", category=DeprecationWarning)


Expand Down

0 comments on commit 7b160c7

Please sign in to comment.