Skip to content

Commit

Permalink
fix: Fix unhashable Snowflake and Redshift sources
Browse files Browse the repository at this point in the history
Signed-off-by: Willem Pienaar <git@willem.co>
  • Loading branch information
woop committed Mar 5, 2022
1 parent ca5ad24 commit 6f8a3b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sdk/python/feast/infra/offline_stores/redshift_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ def from_proto(data_source: DataSourceProto):
query=data_source.redshift_options.query,
)

# Note: Python requires redefining hash in child classes that override __eq__
def __hash__(self):
return super().__hash__()

def __eq__(self, other):
if not isinstance(other, RedshiftSource):
raise TypeError(
Expand Down
4 changes: 4 additions & 0 deletions sdk/python/feast/infra/offline_stores/snowflake_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ def from_proto(data_source: DataSourceProto):
query=data_source.snowflake_options.query,
)

# Note: Python requires redefining hash in child classes that override __eq__
def __hash__(self):
return super().__hash__()

def __eq__(self, other):
if not isinstance(other, SnowflakeSource):
raise TypeError(
Expand Down

0 comments on commit 6f8a3b0

Please sign in to comment.