List all feature views
(ctx: click.Context, tags: list[str])
| 51 | @tagsOption |
| 52 | @click.pass_context |
| 53 | def feature_view_list(ctx: click.Context, tags: list[str]): |
| 54 | """ |
| 55 | List all feature views |
| 56 | """ |
| 57 | store = create_feature_store(ctx) |
| 58 | table = [] |
| 59 | tags_filter = utils.tags_list_to_dict(tags) |
| 60 | for feature_view in [ |
| 61 | *store.list_batch_feature_views(tags=tags_filter), |
| 62 | *store.list_on_demand_feature_views(tags=tags_filter), |
| 63 | ]: |
| 64 | entities = set() |
| 65 | if isinstance(feature_view, FeatureView): |
| 66 | entities.update(feature_view.entities) |
| 67 | elif isinstance(feature_view, OnDemandFeatureView): |
| 68 | for backing_fv in feature_view.source_feature_view_projections.values(): |
| 69 | entities.update(store.get_feature_view(backing_fv.name).entities) |
| 70 | enabled = getattr(feature_view, "enabled", True) |
| 71 | state = getattr(feature_view, "state", FeatureViewState.STATE_UNSPECIFIED) |
| 72 | state_display = ( |
| 73 | state.name if isinstance(state, FeatureViewState) else str(state) |
| 74 | ) |
| 75 | table.append( |
| 76 | [ |
| 77 | feature_view.name, |
| 78 | entities if len(entities) > 0 else "n/a", |
| 79 | type(feature_view).__name__, |
| 80 | "Yes" if enabled else "No", |
| 81 | state_display, |
| 82 | ] |
| 83 | ) |
| 84 | |
| 85 | from tabulate import tabulate |
| 86 | |
| 87 | print( |
| 88 | tabulate( |
| 89 | table, |
| 90 | headers=["NAME", "ENTITIES", "TYPE", "ENABLED", "STATE"], |
| 91 | tablefmt="plain", |
| 92 | ) |
| 93 | ) |
| 94 | |
| 95 | |
| 96 | @feature_views_cmd.command("enable") |
nothing calls this directly
no test coverage detected