Skip to content

Commit

Permalink
chore: remove formatting changes
Browse files Browse the repository at this point in the history
Signed-off-by: Zach <zbarnett@expediagroup.com>
  • Loading branch information
Zach committed Aug 19, 2024
1 parent 2a3959c commit 936ffc7
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions sdk/python/feast/infra/registry/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,7 @@ def apply_user_metadata(
)
conn.execute(update_stmt)
else:
raise FeatureViewNotFoundException(
feature_view.name, project=project)
raise FeatureViewNotFoundException(feature_view.name, project=project)

def _infer_fv_table(self, feature_view):
if isinstance(feature_view, StreamFeatureView):
Expand All @@ -666,8 +665,7 @@ def _infer_fv_table(self, feature_view):
elif isinstance(feature_view, OnDemandFeatureView):
table = on_demand_feature_views
else:
raise ValueError(
f"Unexpected feature view type: {type(feature_view)}")
raise ValueError(f"Unexpected feature view type: {type(feature_view)}")
return table

def _infer_fv_classes(self, feature_view):
Expand All @@ -678,8 +676,7 @@ def _infer_fv_classes(self, feature_view):
elif isinstance(feature_view, OnDemandFeatureView):
python_class, proto_class = OnDemandFeatureView, OnDemandFeatureViewProto
else:
raise ValueError(
f"Unexpected feature view type: {type(feature_view)}")
raise ValueError(f"Unexpected feature view type: {type(feature_view)}")
return python_class, proto_class

def get_user_metadata(
Expand All @@ -689,14 +686,12 @@ def get_user_metadata(

name = feature_view.name
with self.engine.begin() as conn:
stmt = select(table).where(
getattr(table.c, "feature_view_name") == name)
stmt = select(table).where(getattr(table.c, "feature_view_name") == name)
row = conn.execute(stmt).first()
if row:
return row._mapping["user_metadata"]
else:
raise FeatureViewNotFoundException(
feature_view.name, project=project)
raise FeatureViewNotFoundException(feature_view.name, project=project)

def proto(self) -> RegistryProto:
r = RegistryProto()
Expand Down Expand Up @@ -727,8 +722,7 @@ def proto(self) -> RegistryProto:
# This is suuuper jank. Because of https://github.com/feast-dev/feast/issues/2783,
# the registry proto only has a single infra field, which we're currently setting as the "last" project.
r.infra.CopyFrom(self.get_infra(project).to_proto())
last_updated_timestamps.append(
self._get_last_updated_metadata(project))
last_updated_timestamps.append(self._get_last_updated_metadata(project))

if last_updated_timestamps:
r.last_updated.FromDatetime(max(last_updated_timestamps))
Expand Down Expand Up @@ -757,8 +751,7 @@ def _apply_object(
update_datetime = _utc_now()
update_time = int(update_datetime.timestamp())
stmt = select(table).where(
getattr(
table.c, id_field_name) == name, table.c.project_id == project
getattr(table.c, id_field_name) == name, table.c.project_id == project
)
row = conn.execute(stmt).first()
if hasattr(obj, "last_updated_timestamp"):
Expand Down Expand Up @@ -804,8 +797,7 @@ def _apply_object(
if hasattr(obj_proto, "meta") and hasattr(
obj_proto.meta, "created_timestamp"
):
obj_proto.meta.created_timestamp.FromDatetime(
update_datetime)
obj_proto.meta.created_timestamp.FromDatetime(update_datetime)

values = {
id_field_name: name,
Expand Down Expand Up @@ -851,8 +843,7 @@ def _delete_object(
):
with self.engine.begin() as conn:
stmt = delete(table).where(
getattr(
table.c, id_field_name) == name, table.c.project_id == project
getattr(table.c, id_field_name) == name, table.c.project_id == project
)
rows = conn.execute(stmt)
if rows.rowcount < 1 and not_found_exception:
Expand All @@ -876,8 +867,7 @@ def _get_object(

with self.engine.begin() as conn:
stmt = select(table).where(
getattr(
table.c, id_field_name) == name, table.c.project_id == project
getattr(table.c, id_field_name) == name, table.c.project_id == project
)
row = conn.execute(stmt).first()
if row:
Expand Down

0 comments on commit 936ffc7

Please sign in to comment.