Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make feast registry-dump print the whole registry as one json #2040

Merged
merged 2 commits into from Nov 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 30 additions & 2 deletions sdk/python/feast/repo_operations.py
@@ -1,14 +1,17 @@
import importlib
import json
import os
import random
import re
import sys
from collections import defaultdict
from importlib.abc import Loader
from pathlib import Path
from typing import List, NamedTuple, Set, Tuple, Union, cast

import click
from click.exceptions import BadParameter
from google.protobuf.json_format import MessageToDict

from feast import Entity, FeatureTable
from feast.base_feature_view import BaseFeatureView
Expand Down Expand Up @@ -336,14 +339,39 @@ def teardown(repo_config: RepoConfig, repo_path: Path):
@log_exceptions_and_usage
def registry_dump(repo_config: RepoConfig, repo_path: Path):
""" For debugging only: output contents of the metadata registry """
from colorama import Fore, Style

registry_config = repo_config.get_registry_config()
project = repo_config.project
registry = Registry(registry_config=registry_config, repo_path=repo_path)
registry_dict = defaultdict(list)

for entity in registry.list_entities(project=project):
print(entity)
registry_dict["entities"].append(MessageToDict(entity.to_proto()))
for feature_view in registry.list_feature_views(project=project):
print(feature_view)
registry_dict["featureViews"].append(MessageToDict(feature_view.to_proto()))
for feature_table in registry.list_feature_tables(project=project):
registry_dict["featureTables"].append(MessageToDict(feature_table.to_proto()))
for feature_service in registry.list_feature_services(project=project):
registry_dict["featureServices"].append(
MessageToDict(feature_service.to_proto())
)
for on_demand_feature_view in registry.list_on_demand_feature_views(
project=project
):
registry_dict["onDemandFeatureViews"].append(
MessageToDict(on_demand_feature_view.to_proto())
)
for request_feature_view in registry.list_request_feature_views(project=project):
registry_dict["requestFeatureViews"].append(
MessageToDict(request_feature_view.to_proto())
)
warning = (
"Warning: The registry-dump command is for debugging only and may contain "
"breaking changes in the future. No guarantees are made on this interface."
)
click.echo(f"{Style.BRIGHT}{Fore.YELLOW}{warning}{Style.RESET_ALL}")
click.echo(json.dumps(registry_dict, indent=2))


def cli_check_repo(repo_path: Path):
Expand Down