MCPcopy
hub / github.com/feast-dev/feast / diff_between

Function diff_between

sdk/python/feast/diff/registry_diff.py:253–311  ·  view source on GitHub ↗

Returns the difference between the current and desired repo states. Args: registry: The registry storing the current repo state. current_project: The Feast project for which the diff is being computed. desired_repo_contents: The desired repo state.

(
    registry: BaseRegistry,
    current_project: str,
    desired_repo_contents: RepoContents,
)

Source from the content-addressed store, hash-verified

251
252
253def diff_between(
254 registry: BaseRegistry,
255 current_project: str,
256 desired_repo_contents: RepoContents,
257) -> RegistryDiff:
258 """
259 Returns the difference between the current and desired repo states.
260
261 Args:
262 registry: The registry storing the current repo state.
263 current_project: The Feast project for which the diff is being computed.
264 desired_repo_contents: The desired repo state.
265 """
266 diff = RegistryDiff()
267
268 (
269 objs_to_keep,
270 objs_to_delete,
271 objs_to_update,
272 objs_to_add,
273 ) = extract_objects_for_keep_delete_update_add(
274 registry, current_project, desired_repo_contents
275 )
276
277 for object_type in FEAST_OBJECT_TYPES:
278 objects_to_keep = objs_to_keep[object_type]
279 objects_to_delete = objs_to_delete[object_type]
280 objects_to_update = objs_to_update[object_type]
281 objects_to_add = objs_to_add[object_type]
282
283 for e in objects_to_add:
284 diff.add_feast_object_diff(
285 FeastObjectDiff(
286 name=e.name,
287 feast_object_type=object_type,
288 current_feast_object=None,
289 new_feast_object=e,
290 feast_object_property_diffs=[],
291 transition_type=TransitionType.CREATE,
292 )
293 )
294 for e in objects_to_delete:
295 diff.add_feast_object_diff(
296 FeastObjectDiff(
297 name=e.name,
298 feast_object_type=object_type,
299 current_feast_object=e,
300 new_feast_object=None,
301 feast_object_property_diffs=[],
302 transition_type=TransitionType.DELETE,
303 )
304 )
305 for e in objects_to_update:
306 current_obj = [_e for _e in objects_to_keep if _e.name == e.name][0]
307 diff.add_feast_object_diff(
308 diff_registry_objects(current_obj, e, object_type)
309 )
310

Callers 1

planMethod · 0.90

Calls 5

add_feast_object_diffMethod · 0.95
RegistryDiffClass · 0.85
FeastObjectDiffClass · 0.85
diff_registry_objectsFunction · 0.85

Tested by

no test coverage detected