Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixing linter issues
Signed-off-by: Nick Quinn <nicholas_quinn@apple.com>
  • Loading branch information
nickquinn408 authored and ntkathole committed Mar 10, 2026
commit fe5c0b07ec8be1922b97c412319c94cefbaab76e
4 changes: 3 additions & 1 deletion sdk/python/feast/batch_feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ def __init__(
*,
name: str,
mode: Union[TransformationMode, str] = TransformationMode.PYTHON,
source: Union[DataSource, "BatchFeatureView", List["BatchFeatureView"]],
source: Optional[
Union[DataSource, "BatchFeatureView", List["BatchFeatureView"]]
] = None,
Comment thread
nquinn408 marked this conversation as resolved.
sink_source: Optional[DataSource] = None,
entities: Optional[List[Entity]] = None,
ttl: Optional[timedelta] = None,
Expand Down
18 changes: 13 additions & 5 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,11 +702,21 @@ def _make_inferences(
)

update_data_sources_with_inferred_event_timestamp_col(
[view.batch_source for view in views_to_update if view.batch_source is not None], self.config
[
view.batch_source
for view in views_to_update
if view.batch_source is not None
],
self.config,
)

update_data_sources_with_inferred_event_timestamp_col(
[view.batch_source for view in sfvs_to_update if view.batch_source is not None], self.config
[
view.batch_source
for view in sfvs_to_update
if view.batch_source is not None
],
self.config,
)

# New feature views may reference previously applied entities.
Expand Down Expand Up @@ -2417,9 +2427,7 @@ def write_to_offline_store(
provider = self._get_provider()
# Get columns of the batch source and the input dataframe.
if feature_view.batch_source is None:
raise ValueError(
f"Feature view '{feature_view.name}' has no batch_source."
)
raise ValueError(f"Feature view '{feature_view.name}' has no batch_source.")
column_names_and_types = (
provider.get_table_column_names_and_types_from_data_source(
self.config, feature_view.batch_source
Expand Down
9 changes: 3 additions & 6 deletions sdk/python/feast/feature_view_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,9 @@ def from_feature_view_definition(feature_view: "FeatureView"):
name_alias=None,
features=feature_view.features,
desired_features=[],
timestamp_field=batch_source.created_timestamp_column
or None,
created_timestamp_column=batch_source.created_timestamp_column
or None,
date_partition_column=batch_source.date_partition_column
or None,
timestamp_field=batch_source.created_timestamp_column or None,
created_timestamp_column=batch_source.created_timestamp_column or None,
date_partition_column=batch_source.date_partition_column or None,
batch_source=batch_source or None,
)
else:
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/feature_view_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ def resolve_feature_view_source(
if not is_derived_view:
# Regular feature view - use its batch_source directly
if feature_view.batch_source is None:
raise ValueError(
f"Feature view '{feature_view.name}' has no batch_source."
)
raise ValueError(f"Feature view '{feature_view.name}' has no batch_source.")
return FeatureViewSourceInfo(
data_source=feature_view.batch_source,
source_type="batch_source",
Expand Down
5 changes: 4 additions & 1 deletion sdk/python/feast/infra/offline_stores/dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,10 @@ def _field_mapping(
full_feature_names: bool,
) -> Tuple[dd.DataFrame, str]:
# Rename columns by the field mapping dictionary if it exists
if feature_view.batch_source is not None and feature_view.batch_source.field_mapping:
if (
feature_view.batch_source is not None
and feature_view.batch_source.field_mapping
):
df_to_join = _run_dask_field_mapping(
df_to_join, feature_view.batch_source.field_mapping
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ def _get_offline_store_for_feature_view(
) -> OfflineStore:
self._initialize_offline_stores(config)
if feature_view.batch_source is None:
raise ValueError(
f"Feature view '{feature_view.name}' has no batch_source."
)
raise ValueError(f"Feature view '{feature_view.name}' has no batch_source.")
source_type = feature_view.batch_source.source_type()
store_key = self.get_source_key_from_type(source_type)
if store_key is None:
Expand Down
4 changes: 1 addition & 3 deletions sdk/python/feast/infra/offline_stores/ibis.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,7 @@ def offline_write_batch_ibis(
data_source_writer: Callable[[pyarrow.Table, DataSource, str], None],
):
if feature_view.batch_source is None:
raise ValueError(
f"Feature view '{feature_view.name}' has no batch_source."
)
raise ValueError(f"Feature view '{feature_view.name}' has no batch_source.")
pa_schema, column_names = get_pyarrow_schema_from_batch_source(
config, feature_view.batch_source
)
Expand Down
10 changes: 8 additions & 2 deletions sdk/python/feast/infra/passthrough_provider.py
Comment thread
nquinn408 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,10 @@ def _prep_rows_to_write_for_ingestion(
# Note: A dictionary mapping of column names in this data
# source to feature names in a feature table or view. Only used for feature
# columns, not entity or timestamp columns.
if hasattr(feature_view, "batch_source") and feature_view.batch_source is not None:
if (
hasattr(feature_view, "batch_source")
and feature_view.batch_source is not None
):
if feature_view.batch_source.field_mapping is not None:
table = _run_pyarrow_field_mapping(
table, feature_view.batch_source.field_mapping
Expand Down Expand Up @@ -410,7 +413,10 @@ async def ingest_df_async(
)

def ingest_df_to_offline_store(self, feature_view: FeatureView, table: pa.Table):
if feature_view.batch_source is not None and feature_view.batch_source.field_mapping is not None:
if (
feature_view.batch_source is not None
and feature_view.batch_source.field_mapping is not None
):
table = _run_pyarrow_field_mapping(
table, feature_view.batch_source.field_mapping
)
Expand Down
20 changes: 15 additions & 5 deletions sdk/python/feast/repo_operations.py
Comment thread
nquinn408 marked this conversation as resolved.
Comment thread
nquinn408 marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ def parse_repo(repo_root: Path) -> RepoContents:

# Handle batch sources defined with feature views.
batch_source = obj.batch_source
if batch_source is not None and not any((batch_source is ds) for ds in res.data_sources):
if batch_source is not None and not any(
(batch_source is ds) for ds in res.data_sources
):
res.data_sources.append(batch_source)

# Handle stream sources defined with feature views.
Expand All @@ -179,7 +181,9 @@ def parse_repo(repo_root: Path) -> RepoContents:

# Handle batch sources defined with feature views.
batch_source = obj.batch_source
if batch_source is not None and not any((batch_source is ds) for ds in res.data_sources):
if batch_source is not None and not any(
(batch_source is ds) for ds in res.data_sources
):
res.data_sources.append(batch_source)
assert obj.stream_source
stream_source = obj.stream_source
Expand All @@ -192,7 +196,9 @@ def parse_repo(repo_root: Path) -> RepoContents:

# Handle batch sources defined with feature views.
batch_source = obj.batch_source
if batch_source is not None and not any((batch_source is ds) for ds in res.data_sources):
if batch_source is not None and not any(
(batch_source is ds) for ds in res.data_sources
):
res.data_sources.append(batch_source)
elif isinstance(obj, Entity) and not any(
(obj is entity) for entity in res.entities
Expand Down Expand Up @@ -231,7 +237,9 @@ def plan(
# TODO: When we support multiple projects in a single repo, we should filter repo contents by project
if not skip_source_validation:
provider = store._get_provider()
data_sources = [t.batch_source for t in repo.feature_views if t.batch_source is not None]
data_sources = [
t.batch_source for t in repo.feature_views if t.batch_source is not None
]
# Make sure the data source used by this feature view is supported by Feast
for data_source in data_sources:
provider.validate_data_source(store.config, data_source)
Expand Down Expand Up @@ -342,7 +350,9 @@ def apply_total_with_repo_instance(
):
if not skip_source_validation:
provider = store._get_provider()
data_sources = [t.batch_source for t in repo.feature_views if t.batch_source is not None]
data_sources = [
t.batch_source for t in repo.feature_views if t.batch_source is not None
]
# Make sure the data source used by this feature view is supported by Feast
for data_source in data_sources:
provider.validate_data_source(store.config, data_source)
Expand Down