MCPcopy
hub / github.com/feast-dev/feast / get_online_features

Function get_online_features

sdk/python/feast/cli/features.py:113–136  ·  view source on GitHub ↗

Fetch online feature values for a given entity ID

(ctx: click.Context, entities: List[str], features: List[str])

Source from the content-addressed store, hash-verified

111)
112@click.pass_context
113def get_online_features(ctx: click.Context, entities: List[str], features: List[str]):
114 """
115 Fetch online feature values for a given entity ID
116 """
117 store = create_feature_store(ctx)
118 entity_dict: dict[str, List[str]] = {}
119 for entity in entities:
120 try:
121 key, value = entity.split("=")
122 if key not in entity_dict:
123 entity_dict[key] = []
124 entity_dict[key].append(value)
125 except ValueError:
126 click.echo(f"Invalid entity format: {entity}. Use key=value format.")
127 return
128 entity_rows = [
129 dict(zip(entity_dict.keys(), values)) for values in zip(*entity_dict.values())
130 ]
131 feature_vector = store.get_online_features(
132 features=list(features),
133 entity_rows=entity_rows,
134 ).to_dict()
135
136 click.echo(json.dumps(feature_vector, indent=4))
137
138
139@click.command(name="get-historical-features")

Callers

nothing calls this directly

Calls 5

create_feature_storeFunction · 0.90
keysMethod · 0.80
valuesMethod · 0.45
to_dictMethod · 0.45
get_online_featuresMethod · 0.45

Tested by

no test coverage detected