List all features
(ctx: click.Context, output: str)
| 26 | ) |
| 27 | @click.pass_context |
| 28 | def features_list(ctx: click.Context, output: str): |
| 29 | """ |
| 30 | List all features |
| 31 | """ |
| 32 | store = create_feature_store(ctx) |
| 33 | feature_views = [ |
| 34 | *store.list_batch_feature_views(), |
| 35 | *store.list_on_demand_feature_views(), |
| 36 | *store.list_stream_feature_views(), |
| 37 | ] |
| 38 | feature_list = [] |
| 39 | for fv in feature_views: |
| 40 | for feature in fv.features: |
| 41 | feature_list.append([feature.name, fv.name, str(feature.dtype)]) |
| 42 | |
| 43 | if output == "json": |
| 44 | json_output = [ |
| 45 | {"feature_name": fn, "feature_view": fv, "dtype": dt} |
| 46 | for fv, fn, dt in feature_list |
| 47 | ] |
| 48 | click.echo(json.dumps(json_output, indent=4)) |
| 49 | else: |
| 50 | from tabulate import tabulate |
| 51 | |
| 52 | click.echo( |
| 53 | tabulate( |
| 54 | feature_list, |
| 55 | headers=["Feature", "Feature View", "Data Type"], |
| 56 | tablefmt="plain", |
| 57 | ) |
| 58 | ) |
| 59 | |
| 60 | |
| 61 | @features_cmd.command("describe") |
nothing calls this directly
no test coverage detected