@@ -344,18 +344,27 @@ async def push(request: PushFeaturesRequest) -> None:
344344 async def _get_feast_object (
345345 feature_view_name : str , allow_registry_cache : bool
346346 ) -> FeastObject :
347+ # FIXME: this logic repeated at least 3 times in the codebase - should be centralized
348+ # in logging, in server and in feature_store (Python SDK)
347349 try :
348350 return await run_in_threadpool (
349351 store .get_stream_feature_view ,
350352 feature_view_name ,
351353 allow_registry_cache = allow_registry_cache ,
352354 )
353355 except FeatureViewNotFoundException :
354- return await run_in_threadpool (
355- store .get_feature_view ,
356- feature_view_name ,
357- allow_registry_cache = allow_registry_cache ,
358- )
356+ try :
357+ return await run_in_threadpool (
358+ store .get_feature_view ,
359+ feature_view_name ,
360+ allow_registry_cache = allow_registry_cache ,
361+ )
362+ except FeatureViewNotFoundException :
363+ return await run_in_threadpool (
364+ store .get_on_demand_feature_view ,
365+ feature_view_name ,
366+ allow_registry_cache = allow_registry_cache ,
367+ )
359368
360369 @app .post ("/write-to-online-store" , dependencies = [Depends (inject_user_details )])
361370 async def write_to_online_store (request : WriteToFeatureStoreRequest ) -> None :
0 commit comments