Skip to content

Commit

Permalink
fix: Correctly generate projects-list.json when calling feast ui and …
Browse files Browse the repository at this point in the history
…using postgres as a source (#2845)

* Adjusted postgres_source.py to create correct projects-list.json when calling feast ui.

Signed-off-by: alex.eijssen <alex.eijssen@energyessentials.nl>

* Linting issue

Signed-off-by: alex.eijssen <alex.eijssen@energyessentials.nl>

Co-authored-by: alex.eijssen <alex.eijssen@energyessentials.nl>
  • Loading branch information
AlexEijssen and alex.eijssen authored Jun 24, 2022
1 parent 73a482c commit bee8076
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def __init__(
created_timestamp_column: Optional[str] = "",
field_mapping: Optional[Dict[str, str]] = None,
date_partition_column: Optional[str] = "",
description: Optional[str] = "",
tags: Optional[Dict[str, str]] = None,
owner: Optional[str] = "",
):
self._postgres_options = PostgreSQLOptions(name=name, query=query)

Expand All @@ -27,6 +30,9 @@ def __init__(
created_timestamp_column=created_timestamp_column,
field_mapping=field_mapping,
date_partition_column=date_partition_column,
description=description,
tags=tags,
owner=owner,
)

def __hash__(self):
Expand Down Expand Up @@ -57,14 +63,21 @@ def from_proto(data_source: DataSourceProto):
timestamp_field=data_source.timestamp_field,
created_timestamp_column=data_source.created_timestamp_column,
date_partition_column=data_source.date_partition_column,
description=data_source.description,
tags=dict(data_source.tags),
owner=data_source.owner,
)

def to_proto(self) -> DataSourceProto:
data_source_proto = DataSourceProto(
name=self.name,
type=DataSourceProto.CUSTOM_SOURCE,
data_source_class_type="feast.infra.offline_stores.contrib.postgres_offline_store.postgres_source.PostgreSQLSource",
field_mapping=self.field_mapping,
custom_options=self._postgres_options.to_proto(),
description=self.description,
tags=self.tags,
owner=self.owner,
)

data_source_proto.timestamp_field = self.timestamp_field
Expand Down

0 comments on commit bee8076

Please sign in to comment.