diff --git a/sdk/python/feast/entity.py b/sdk/python/feast/entity.py index a988c200d7..290e6307a4 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 b919706544..db629d677a 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 f9fa0a7881..217303df91 100644 --- a/sdk/python/feast/feature_store.py +++ b/sdk/python/feast/feature_store.py @@ -175,6 +175,16 @@ def version(self) -> str: """Returns the version of the current Feast SDK/CLI.""" return get_version() + 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 7c9f14decf..a41dcf5d5e 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})"