From 0fe2df8fdc99d6550471f6ad4ca424d472c02bd3 Mon Sep 17 00:00:00 2001 From: Danny Chiao Date: Tue, 29 Mar 2022 14:30:40 -0400 Subject: [PATCH] fix Signed-off-by: Danny Chiao --- sdk/python/feast/diff/registry_diff.py | 9 +++++---- sdk/python/tests/integration/registration/test_cli.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sdk/python/feast/diff/registry_diff.py b/sdk/python/feast/diff/registry_diff.py index f39a237fd4..b78087a63b 100644 --- a/sdk/python/feast/diff/registry_diff.py +++ b/sdk/python/feast/diff/registry_diff.py @@ -81,10 +81,11 @@ def to_string(self): def tag_objects_for_keep_delete_update_add( existing_objs: Iterable[FeastObject], desired_objs: Iterable[FeastObject] ) -> Tuple[List[FeastObject], List[FeastObject], List[FeastObject], List[FeastObject]]: - existing_obj_names = {e.name for e in existing_objs} - desired_objs = list(desired_objs) - existing_objs = list(existing_objs) - desired_obj_names = {e.name for e in desired_objs} + # TODO(adchia): Remove the "if X.name" condition when data sources are forced to have names + existing_obj_names = {e.name for e in existing_objs if e.name} + desired_objs = [obj for obj in desired_objs if obj.name] + existing_objs = [obj for obj in existing_objs if obj.name] + desired_obj_names = {e.name for e in desired_objs if e.name} objs_to_add = [e for e in desired_objs if e.name not in existing_obj_names] objs_to_update = [e for e in desired_objs if e.name in existing_obj_names] diff --git a/sdk/python/tests/integration/registration/test_cli.py b/sdk/python/tests/integration/registration/test_cli.py index 456baed260..655e53e759 100644 --- a/sdk/python/tests/integration/registration/test_cli.py +++ b/sdk/python/tests/integration/registration/test_cli.py @@ -89,7 +89,7 @@ def test_universal_cli(environment: Environment): ["data-sources", "describe", "customer_profile_source"], cwd=repo_path, ) assertpy.assert_that(result.returncode).is_equal_to(0) - assertpy.assert_that(fs.list_data_sources()).is_length(5) + assertpy.assert_that(fs.list_data_sources()).is_length(4) # entity & feature view describe commands should fail when objects don't exist result = runner.run(["entities", "describe", "foo"], cwd=repo_path)