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

fix: Import error when calling get_feature_view for feature views with SparkSource #3873

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from enum import Enum
from typing import Any, Callable, Dict, Iterable, Optional, Tuple

from pyspark.sql import SparkSession

from feast import flags_helper
from feast.data_source import DataSource
from feast.errors import DataSourceNoNameException
Expand Down Expand Up @@ -163,6 +161,13 @@ def get_table_column_names_and_types(

def get_table_query_string(self) -> str:
"""Returns a string that can directly be used to reference this table in SQL"""
try:
from pyspark.sql import SparkSession
except ImportError as e:
from feast.errors import FeastExtrasDependencyImportError

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

if self.table:
# Backticks make sure that spark sql knows this a table reference.
table = ".".join([f"`{x}`" for x in self.table.split(".")])
Expand Down
Loading