diff --git a/sdk/python/feast/entity.py b/sdk/python/feast/entity.py index a988c200d7c..290e6307a42 100644 --- a/sdk/python/feast/entity.py +++ b/sdk/python/feast/entity.py @@ -99,6 +99,20 @@ def __init__( self.created_timestamp = None self.last_updated_timestamp = None + def __repr__(self): + return ( + f"Entity(\n" + f" name={self.name!r},\n" + f" value_type={self.value_type!r},\n" + f" join_key={self.join_key!r},\n" + f" description={self.description!r},\n" + f" tags={self.tags!r},\n" + f" owner={self.owner!r},\n" + f" created_timestamp={self.created_timestamp!r},\n" + f" last_updated_timestamp={self.last_updated_timestamp!r}\n" + f")" + ) + def __hash__(self) -> int: return hash((self.name, self.join_key)) diff --git a/sdk/python/feast/feature.py b/sdk/python/feast/feature.py index b9197065449..db629d677a8 100644 --- a/sdk/python/feast/feature.py +++ b/sdk/python/feast/feature.py @@ -58,12 +58,18 @@ def __lt__(self, other): return self.name < other.name def __repr__(self): - # return string representation of the reference - return f"{self.name}-{self.dtype}" + return ( + f"Feature(\n" + f" name={self._name!r},\n" + f" dtype={self._dtype!r},\n" + f" description={self._description!r},\n" + f" labels={self._labels!r}\n" + f")" + ) def __str__(self): # readable string of the reference - return f"Feature<{self.__repr__()}>" + return f"Feature<{self.name}: {self.dtype}>" @property def name(self): diff --git a/sdk/python/feast/feature_store.py b/sdk/python/feast/feature_store.py index f9fa0a78819..40c03f35fa0 100644 --- a/sdk/python/feast/feature_store.py +++ b/sdk/python/feast/feature_store.py @@ -29,6 +29,7 @@ Tuple, Union, cast, + override, ) import pandas as pd @@ -81,7 +82,8 @@ GetOnlineFeaturesResponse, ) from feast.protos.feast.types.EntityKey_pb2 import EntityKey -from feast.protos.feast.types.Value_pb2 import RepeatedValue, Value +from feast.protos.feast.types.Value_pb2 import RepeatedValue +from feast.protos.feast.types.Value_pb2 import Value from feast.protos.feast.types.Value_pb2 import Value as ValueProto from feast.repo_config import RepoConfig, load_repo_config from feast.repo_contents import RepoContents @@ -175,6 +177,17 @@ def version(self) -> str: """Returns the version of the current Feast SDK/CLI.""" return get_version() + @override + def __repr__(self) -> str: + return ( + f"FeatureStore(\n" + f" repo_path={self.repo_path!r},\n" + f" config={self.config!r},\n" + f" registry={self._registry!r},\n" + f" provider={self._provider!r}\n" + f")" + ) + @property def registry(self) -> BaseRegistry: """Gets the registry of this feature store.""" diff --git a/sdk/python/feast/field.py b/sdk/python/feast/field.py index 7c9f14decfd..a41dcf5d5e6 100644 --- a/sdk/python/feast/field.py +++ b/sdk/python/feast/field.py @@ -81,7 +81,14 @@ def __lt__(self, other): return self.name < other.name def __repr__(self): - return f"Field(name='{self.name}', dtype={self.dtype}, description='{self.description}' tags={self.tags})" + return ( + f"Field(\n" + f" name={self.name!r},\n" + f" dtype={self.dtype!r},\n" + f" description={self.description!r},\n" + f" tags={self.tags!r}\n" + f")" + ) def __str__(self): return f"Field(name={self.name}, dtype={self.dtype}, tags={self.tags})"