-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathfeature_views.py
More file actions
39 lines (32 loc) · 1.14 KB
/
feature_views.py
File metadata and controls
39 lines (32 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from typing import Dict
from fastapi import APIRouter, Depends, Query
from feast.api.registry.rest.rest_utils import grpc_call, parse_tags
from feast.registry_server import RegistryServer_pb2
def get_feature_view_router(grpc_handler) -> APIRouter:
router = APIRouter()
@router.get("/feature_views/{name}")
def get_any_feature_view(
name: str,
project: str = Query(...),
allow_cache: bool = Query(True),
):
req = RegistryServer_pb2.GetAnyFeatureViewRequest(
name=name,
project=project,
allow_cache=allow_cache,
)
response = grpc_call(grpc_handler.GetAnyFeatureView, req)
return response.get("anyFeatureView", {})
@router.get("/feature_views")
def list_all_feature_views(
project: str = Query(...),
allow_cache: bool = Query(True),
tags: Dict[str, str] = Depends(parse_tags),
):
req = RegistryServer_pb2.ListAllFeatureViewsRequest(
project=project,
allow_cache=allow_cache,
tags=tags,
)
return grpc_call(grpc_handler.ListAllFeatureViews, req)
return router