forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path__init__.py
More file actions
54 lines (42 loc) · 1.66 KB
/
Copy path__init__.py
File metadata and controls
54 lines (42 loc) · 1.66 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Catalog API — Iceberg REST Catalog endpoints for the Feast server.
This module adds a second API surface to the Feast server process:
/api/catalog/v1/{prefix}/namespaces — namespace CRUD (delegates to Feast projects)
/api/catalog/v1/{prefix}/namespaces/{ns}/tables — table CRUD (merges Feast + supplemental)
Integration: one line in RestRegistryServer._register_routes():
register_catalog_routes(self.app, self.grpc_handler)
Target location in Feast repo: sdk/python/feast/api/catalog/__init__.py
"""
from __future__ import annotations
import os
from typing import Optional
from fastapi import FastAPI
from .namespaces import get_namespace_router
from .store import SupplementalStore
from .tables import get_table_router
_CATALOG_API_PREFIX = "/api/catalog/v1"
def register_catalog_routes(
app: FastAPI,
grpc_handler,
supplemental_db_path: Optional[str] = None,
) -> None:
"""
Register Catalog API routes on the Feast FastAPI app.
Call this from RestRegistryServer._register_routes() alongside
the existing register_all_routes() call. Both API surfaces share
the same FastAPI app, auth middleware, and TLS config.
"""
db_path = supplemental_db_path or os.environ.get(
"CATALOG_SUPPLEMENTAL_DB_PATH", "/tmp/catalog_supplemental.db"
)
supplemental_store = SupplementalStore(db_path=db_path)
app.include_router(
get_namespace_router(grpc_handler),
prefix=_CATALOG_API_PREFIX,
tags=["Catalog API — Namespaces"],
)
app.include_router(
get_table_router(grpc_handler, supplemental_store),
prefix=_CATALOG_API_PREFIX,
tags=["Catalog API — Tables"],
)