def test_get_list_alltypes(client: Client, alltypes_entity: Entity, alltypes_featuretable: FeatureTable): # ApplyEntity client.apply_entity(alltypes_entity) # GetEntity Check assert client.get_entity(name="alltypes_id") == alltypes_entity # ListEntities Check alltypes_filtering_labels = {"cat": "alltypes"} actual_alltypes_entities = client.list_entities( labels=alltypes_filtering_labels) assert len(actual_alltypes_entities) == 1 # ApplyFeatureTable client.apply_feature_table(alltypes_featuretable) # GetFeatureTable Check actual_get_feature_table = client.get_feature_table(name="alltypes") assert actual_get_feature_table == alltypes_featuretable # ListFeatureTables Check actual_list_feature_table = [ ft for ft in client.list_feature_tables() if ft.name == "alltypes" ][0] assert actual_list_feature_table == alltypes_featuretable
def test_get_list_basic( client: Client, customer_entity: Entity, driver_entity: Entity, basic_featuretable: FeatureTable, ): # ApplyEntity client.apply_entity(customer_entity) client.apply_entity(driver_entity) # GetEntity Check assert client.get_entity(name="customer_id") == customer_entity assert client.get_entity(name="driver_id") == driver_entity # ListEntities Check common_filtering_labels = {"common_key": "common_val"} matchmaking_filtering_labels = {"team": "matchmaking"} actual_common_entities = client.list_entities( labels=common_filtering_labels) actual_matchmaking_entities = client.list_entities( labels=matchmaking_filtering_labels) assert len(actual_common_entities) == 2 assert len(actual_matchmaking_entities) == 1 # ApplyFeatureTable client.apply_feature_table(basic_featuretable) # GetFeatureTable Check actual_get_feature_table = client.get_feature_table( name="basic_featuretable") assert actual_get_feature_table == basic_featuretable # ListFeatureTables Check actual_list_feature_table = [ ft for ft in client.list_feature_tables() if ft.name == "basic_featuretable" ][0] assert actual_list_feature_table == basic_featuretable
def entity_list(project: str, labels: str): """ List all entities """ feast_client = Client() # type: Client labels_dict = _get_labels_dict(labels) table = [] for entity in feast_client.list_entities(project=project, labels=labels_dict): table.append([entity.name, entity.description, entity.value_type]) from tabulate import tabulate print(tabulate(table, headers=["NAME", "DESCRIPTION", "TYPE"], tablefmt="plain"))