From 6ad9a5b4d307eff3120587a402a47ad659919a1c Mon Sep 17 00:00:00 2001 From: Tsotne Tabidze Date: Thu, 8 Apr 2021 09:53:30 -0700 Subject: [PATCH] Add materialize-incremental cli command (#1442) Signed-off-by: Tsotne Tabidze --- sdk/python/feast/cli.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sdk/python/feast/cli.py b/sdk/python/feast/cli.py index 621fd21c8f..2f7c4824d3 100644 --- a/sdk/python/feast/cli.py +++ b/sdk/python/feast/cli.py @@ -416,7 +416,7 @@ def materialize_command(start_ts: str, end_ts: str, repo_path: str, views: List[ """ Run a (non-incremental) materialization job to ingest data into the online store. Feast will read all data between START_TS and END_TS from the offline store and write it to the - online store. If you don't specify feature view names using --views, all registred Feature + online store. If you don't specify feature view names using --views, all registered Feature Views will be materialized. START_TS and END_TS should be in ISO 8601 format, e.g. '2021-07-16T19:20:01' @@ -429,6 +429,30 @@ def materialize_command(start_ts: str, end_ts: str, repo_path: str, views: List[ ) +@cli.command("materialize-incremental") +@click.argument("end_ts") +@click.argument( + "repo_path", type=click.Path(dir_okay=True, exists=True,), default=Path.cwd +) +@click.option( + "--views", "-v", help="Feature views to incrementally materialize", multiple=True, +) +def materialize_incremental_command(end_ts: str, repo_path: str, views: List[str]): + """ + Run an incremental materialization job to ingest new data into the online store. Feast will read + all data from the previously ingested point to END_TS from the offline store and write it to the + online store. If you don't specify feature view names using --views, all registered Feature + Views will be incrementally materialized. + + END_TS should be in ISO 8601 format, e.g. '2021-07-16T19:20:01' + """ + store = FeatureStore(repo_path=repo_path) + store.materialize_incremental( + feature_views=None if not views else views, + end_date=datetime.fromisoformat(end_ts), + ) + + @cli.command("init") @click.option("--minimal", "-m", is_flag=True, help="Only generate the config") def init_command(minimal: bool):