Skip to content

Commit 24d2ba7

Browse files
committed
Add table formatted list printing to feature sets
1 parent 43a69da commit 24d2ba7

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

sdk/python/cli.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,13 @@ def list():
135135
core_url=feast_config.get_config_property_or_fail("core_url")
136136
) # type: Client
137137

138+
table = []
138139
for fs in feast_client.list_feature_sets():
139-
print(f"{fs.name}:{fs.version}")
140+
table.append([fs.name, fs.version])
141+
142+
from tabulate import tabulate
143+
144+
print(tabulate(table, headers=["NAME", "VERSION"], tablefmt="plain"))
140145

141146

142147
@feature_set.command()

sdk/python/feast/client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,13 @@ def _apply_feature_set(self, feature_set: FeatureSet):
218218
applied_fs = FeatureSet.from_proto(apply_fs_response.feature_set)
219219

220220
if apply_fs_response.status == ApplyFeatureSetResponse.Status.CREATED:
221-
print(f'Feature set updated/created: "{applied_fs.name}:{applied_fs.version}".')
221+
print(
222+
f'Feature set updated/created: "{applied_fs.name}:{applied_fs.version}".'
223+
)
222224
feature_set._update_from_feature_set(applied_fs, is_dirty=False)
223225
return
224226
if apply_fs_response.status == ApplyFeatureSetResponse.Status.NO_CHANGE:
225-
print(f'No change detected in feature set {feature_set.name}')
227+
print(f"No change detected in feature set {feature_set.name}")
226228
return
227229
except grpc.RpcError as e:
228230
print(format_grpc_exception("ApplyFeatureSet", e.code(), e.details()))
@@ -345,7 +347,10 @@ def get_batch_features(
345347
self._validate_entity_rows_for_batch_retrieval(entity_rows, fs_request)
346348

347349
# we want the timestamp column naming to be consistent with the rest of feast
348-
entity_rows.columns = ['event_timestamp' if col=='datetime' else col for col in entity_rows.columns]
350+
entity_rows.columns = [
351+
"event_timestamp" if col == "datetime" else col
352+
for col in entity_rows.columns
353+
]
349354

350355
# Retrieve serving information to determine store type and staging location
351356
serving_info = (

sdk/python/feast/feature_set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def ingest(
305305
force_update: bool = False,
306306
timeout: int = 5,
307307
max_workers: int = CPU_COUNT,
308-
disable_progress_bar: bool = False
308+
disable_progress_bar: bool = False,
309309
):
310310

311311
pbar = tqdm(unit="rows", total=dataframe.shape[0], disable=disable_progress_bar)

sdk/python/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"PyYAML==5.1.2",
4141
"fastavro==0.*",
4242
"kafka-python==1.4.*",
43+
"tabulate==0.8.*",
4344
"toml==0.10.0",
4445
"tqdm==4.*",
4546
"numpy",

0 commit comments

Comments
 (0)