Skip to content
Prev Previous commit
Next Next commit
fix: Improvements following the PR comments. Remove unnecessary changes.
Signed-off-by: Shuchu Han <shuchu.han@gmail.com>
  • Loading branch information
shuchu committed Feb 13, 2024
commit 9573d41b2007ddef4f05b314118790b43716c7b7
4 changes: 2 additions & 2 deletions sdk/python/feast/infra/offline_stores/offline_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ def to_arrow(

return pyarrow.Table.from_pandas(features_df)

def to_sql(self) -> str: # type: ignore
def to_sql(self) -> str:
"""
Return RetrievalJob generated SQL statement if applicable.
"""
pass
raise NotImplementedError

def _to_df_internal(self, timeout: Optional[int] = None) -> pd.DataFrame:
"""
Expand Down
4 changes: 2 additions & 2 deletions sdk/python/feast/infra/offline_stores/snowflake_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ def get_table_column_names_and_types(
else:
row["snowflake_type"] = "NUMBERwSCALE"

elif row["type_code"] in {5, 9, 12}:
elif row["type_code"] in [5, 9, 12]:
error = snowflake_unsupported_map[row["type_code"]]
raise NotImplementedError(
f"The following Snowflake Data Type is not supported: {error}"
)
elif row["type_code"] in {1, 2, 3, 4, 6, 7, 8, 10, 11, 13}:
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(
Expand Down
70 changes: 35 additions & 35 deletions sdk/python/feast/infra/registry/base_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def apply_entity(self, entity: Entity, project: str, commit: bool = True):
project: Feast project that this entity belongs to
commit: Whether the change should be persisted immediately
"""
pass
raise NotImplementedError

@abstractmethod
def delete_entity(self, name: str, project: str, commit: bool = True):
Expand All @@ -63,7 +63,7 @@ def delete_entity(self, name: str, project: str, commit: bool = True):
project: Feast project that this entity belongs to
commit: Whether the change should be persisted immediately
"""
pass
raise NotImplementedError

@abstractmethod
def get_entity(self, name: str, project: str, allow_cache: bool = False) -> Entity:
Expand All @@ -79,7 +79,7 @@ def get_entity(self, name: str, project: str, allow_cache: bool = False) -> Enti
Returns either the specified entity, or raises an exception if
none is found
"""
pass
raise NotImplementedError

@abstractmethod
def list_entities(self, project: str, allow_cache: bool = False) -> List[Entity]:
Expand All @@ -93,7 +93,7 @@ def list_entities(self, project: str, allow_cache: bool = False) -> List[Entity]
Returns:
List of entities
"""
pass
raise NotImplementedError

# Data source operations
@abstractmethod
Expand All @@ -108,7 +108,7 @@ def apply_data_source(
project: Feast project that this data source belongs to
commit: Whether to immediately commit to the registry
"""
pass
raise NotImplementedError

@abstractmethod
def delete_data_source(self, name: str, project: str, commit: bool = True):
Expand All @@ -120,7 +120,7 @@ def delete_data_source(self, name: str, project: str, commit: bool = True):
project: Feast project that this data source belongs to
commit: Whether the change should be persisted immediately
"""
pass
raise NotImplementedError

@abstractmethod
def get_data_source(
Expand All @@ -137,7 +137,7 @@ def get_data_source(
Returns:
Returns either the specified data source, or raises an exception if none is found
"""
pass
raise NotImplementedError

@abstractmethod
def list_data_sources(
Expand All @@ -153,7 +153,7 @@ def list_data_sources(
Returns:
List of data sources
"""
pass
raise NotImplementedError

# Feature service operations
@abstractmethod
Expand All @@ -167,7 +167,7 @@ def apply_feature_service(
feature_service: A feature service that will be registered
project: Feast project that this entity belongs to
"""
pass
raise NotImplementedError

@abstractmethod
def delete_feature_service(self, name: str, project: str, commit: bool = True):
Expand All @@ -179,7 +179,7 @@ def delete_feature_service(self, name: str, project: str, commit: bool = True):
project: Feast project that this feature service belongs to
commit: Whether the change should be persisted immediately
"""
pass
raise NotImplementedError

@abstractmethod
def get_feature_service(
Expand All @@ -197,7 +197,7 @@ def get_feature_service(
Returns either the specified feature service, or raises an exception if
none is found
"""
pass
raise NotImplementedError

@abstractmethod
def list_feature_services(
Expand All @@ -213,7 +213,7 @@ def list_feature_services(
Returns:
List of feature services
"""
pass
raise NotImplementedError

# Feature view operations
@abstractmethod
Expand All @@ -228,7 +228,7 @@ def apply_feature_view(
project: Feast project that this feature view belongs to
commit: Whether the change should be persisted immediately
"""
pass
raise NotImplementedError

@abstractmethod
def delete_feature_view(self, name: str, project: str, commit: bool = True):
Expand All @@ -240,7 +240,7 @@ def delete_feature_view(self, name: str, project: str, commit: bool = True):
project: Feast project that this feature view belongs to
commit: Whether the change should be persisted immediately
"""
pass
raise NotImplementedError

# stream feature view operations
@abstractmethod
Expand All @@ -259,7 +259,7 @@ def get_stream_feature_view(
Returns either the specified feature view, or raises an exception if
none is found
"""
pass
raise NotImplementedError

@abstractmethod
def list_stream_feature_views(
Expand All @@ -275,7 +275,7 @@ def list_stream_feature_views(
Returns:
List of stream feature views
"""
pass
raise NotImplementedError

# on demand feature view operations
@abstractmethod
Expand All @@ -294,7 +294,7 @@ def get_on_demand_feature_view(
Returns either the specified on demand feature view, or raises an exception if
none is found
"""
pass
raise NotImplementedError

@abstractmethod
def list_on_demand_feature_views(
Expand All @@ -310,7 +310,7 @@ def list_on_demand_feature_views(
Returns:
List of on demand feature views
"""
pass
raise NotImplementedError

# regular feature view operations
@abstractmethod
Expand All @@ -329,7 +329,7 @@ def get_feature_view(
Returns either the specified feature view, or raises an exception if
none is found
"""
pass
raise NotImplementedError

@abstractmethod
def list_feature_views(
Expand All @@ -345,7 +345,7 @@ def list_feature_views(
Returns:
List of feature views
"""
pass
raise NotImplementedError

# request feature view operations
@abstractmethod
Expand All @@ -364,7 +364,7 @@ def get_request_feature_view(
Returns either the specified feature view, or raises an exception if
none is found
"""
pass
raise NotImplementedError

@abstractmethod
def list_request_feature_views(
Expand All @@ -380,7 +380,7 @@ def list_request_feature_views(
Returns:
List of request feature views
"""
pass
raise NotImplementedError

@abstractmethod
def apply_materialization(
Expand All @@ -401,7 +401,7 @@ def apply_materialization(
end_date (datetime): End date of the materialization interval to track
commit: Whether the change should be persisted immediately
"""
pass
raise NotImplementedError

# Saved dataset operations
@abstractmethod
Expand All @@ -419,7 +419,7 @@ def apply_saved_dataset(
project: Feast project that this dataset belongs to
commit: Whether the change should be persisted immediately
"""
pass
raise NotImplementedError

@abstractmethod
def get_saved_dataset(
Expand All @@ -437,7 +437,7 @@ def get_saved_dataset(
Returns either the specified SavedDataset, or raises an exception if
none is found
"""
pass
raise NotImplementedError

def delete_saved_dataset(self, name: str, project: str, allow_cache: bool = False):
"""
Expand All @@ -452,7 +452,7 @@ def delete_saved_dataset(self, name: str, project: str, allow_cache: bool = Fals
Returns either the specified SavedDataset, or raises an exception if
none is found
"""
pass
raise NotImplementedError

@abstractmethod
def list_saved_datasets(
Expand All @@ -468,7 +468,7 @@ def list_saved_datasets(
Returns:
Returns the list of SavedDatasets
"""
pass
raise NotImplementedError

# Validation reference operations
@abstractmethod
Expand All @@ -486,7 +486,7 @@ def apply_validation_reference(
project: Feast project that this dataset belongs to
commit: Whether the change should be persisted immediately
"""
pass
raise NotImplementedError

@abstractmethod
def delete_validation_reference(self, name: str, project: str, commit: bool = True):
Expand All @@ -498,7 +498,7 @@ def delete_validation_reference(self, name: str, project: str, commit: bool = Tr
project: Feast project that this object belongs to
commit: Whether the change should be persisted immediately
"""
pass
raise NotImplementedError

@abstractmethod
def get_validation_reference(
Expand All @@ -516,7 +516,7 @@ def get_validation_reference(
Returns either the specified ValidationReference, or raises an exception if
none is found
"""
pass
raise NotImplementedError

# TODO: Needs to be implemented.
def list_validation_references(
Expand Down Expand Up @@ -561,7 +561,7 @@ def update_infra(self, infra: Infra, project: str, commit: bool = True):
project: Feast project that the Infra object refers to
commit: Whether the change should be persisted immediately
"""
pass
raise NotImplementedError

@abstractmethod
def get_infra(self, project: str, allow_cache: bool = False) -> Infra:
Expand All @@ -575,7 +575,7 @@ def get_infra(self, project: str, allow_cache: bool = False) -> Infra:
Returns:
The stored Infra object.
"""
pass
raise NotImplementedError

@abstractmethod
def apply_user_metadata(
Expand All @@ -600,17 +600,17 @@ def proto(self) -> RegistryProto:
Returns:
The registry proto object.
"""
pass
raise NotImplementedError

@abstractmethod
def commit(self):
"""Commits the state of the registry cache to the remote registry store."""
pass
raise NotImplementedError

@abstractmethod
def refresh(self, project: Optional[str] = None):
"""Refreshes the state of the registry cache by fetching the registry state from the remote registry store."""
pass
raise NotImplementedError

@staticmethod
def _message_to_sorted_dict(message: Message) -> Dict[str, Any]:
Expand Down
2 changes: 0 additions & 2 deletions sdk/python/feast/repo_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ def _validate_feature_server_config(cls, values: Any) -> Any:
return values

@field_validator("project")
@classmethod
Comment thread
shuchu marked this conversation as resolved.
Outdated
def _validate_project_name(cls, v: str) -> str:
from feast.repo_operations import is_valid_name

Expand All @@ -426,7 +425,6 @@ def _validate_project_name(cls, v: str) -> str:
return v

@field_validator("flags")
@classmethod
def _validate_flags(cls, v: Optional[dict]) -> Optional[dict]:
if not isinstance(v, dict):
return v
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ def create_data_source(
A Data source object, pointing to a table or file that is uploaded/persisted for the purpose of the
test.
"""
pass
raise NotImplementedError

@abstractmethod
def create_offline_store_config(self) -> FeastConfigBaseModel:
pass
raise NotImplementedError

@abstractmethod
def create_saved_dataset_destination(self) -> SavedDatasetStorage:
pass
raise NotImplementedError

@abstractmethod
def create_logged_features_destination(self) -> LoggingDestination:
raise NotImplementedError

@abstractmethod
def teardown(self):
pass
raise NotImplementedError
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def create_data_source(
self,
df: pd.DataFrame,
destination_name: str,
event_timestamp_column="ts",
created_timestamp_column="created_ts",
field_mapping: Optional[Dict[str, str]] = None,
timestamp_field: Optional[str] = "ts",
Expand Down
Loading