@@ -51,18 +51,25 @@ class ApplyFeatureViewRequestBody(BaseModel):
5151 owner : Optional [str ] = ""
5252
5353
54- def _extract_feature_view_from_any (any_feature_view : dict ) -> dict :
54+ def _extract_feature_view_from_any (
55+ any_feature_view : dict , project : Optional [str ] = None
56+ ) -> dict :
5557 """Extract the specific feature view type and data from an AnyFeatureView object.
5658
5759 Args:
5860 any_feature_view: Dictionary containing the AnyFeatureView data
61+ project: Project the feature view was read from, filled into an unset spec.project
5962
6063 Returns:
6164 Dictionary with 'type' and feature view data, or empty dict if no valid type found
6265 """
6366 for key , value in any_feature_view .items ():
6467 if value :
65- return {"type" : key , ** value }
68+ result = {"type" : key , ** value }
69+ spec = result .get ("spec" )
70+ if project and isinstance (spec , dict ) and not spec .get ("project" ):
71+ result ["spec" ] = {** spec , "project" : project }
72+ return result
6673
6774 return {}
6875
@@ -110,7 +117,9 @@ def list_feature_views_all(
110117 response = grpc_call (grpc_handler .ListAllFeatureViews , req )
111118 any_feature_views = response .get ("featureViews" , [])
112119 for any_feature_view in any_feature_views :
113- feature_view = _extract_feature_view_from_any (any_feature_view )
120+ feature_view = _extract_feature_view_from_any (
121+ any_feature_view , project_name
122+ )
114123 if feature_view :
115124 feature_view ["project" ] = project_name
116125 all_feature_views .append (feature_view )
@@ -157,7 +166,7 @@ def get_any_feature_view(
157166 response = grpc_call (grpc_handler .GetAnyFeatureView , req )
158167 any_feature_view = response .get ("anyFeatureView" , {})
159168
160- result = _extract_feature_view_from_any (any_feature_view )
169+ result = _extract_feature_view_from_any (any_feature_view , project )
161170
162171 if include_relationships :
163172 relationships = get_object_relationships (
@@ -315,7 +324,7 @@ def list_all_feature_views(
315324 # Extract the specific type of feature view from each AnyFeatureView
316325 feature_views = []
317326 for any_feature_view in any_feature_views :
318- feature_view = _extract_feature_view_from_any (any_feature_view )
327+ feature_view = _extract_feature_view_from_any (any_feature_view , project )
319328 if feature_view :
320329 feature_views .append (feature_view )
321330
0 commit comments