"""Writes all the options into the formatter if they exist."""
opts= []
forparaminself.get_params(ctx):
rv=param.get_help_record(ctx)
ifrvisnotNone:
opts.append(rv)
ifopts:
withformatter.section("Options(No current command options)"):
formatter.write_dl(opts)
@click.group()
@click.option(
"--chdir",
"-c",
envvar="FEATURE_REPO_DIR_ENV_VAR",
help="Switch to a different feature repository directory before executing the given subcommand. Can also be set via the FEATURE_REPO_DIR_ENV_VAR environment variable.",
)
@click.option(
"--log-level",
default="warning",
help="The logging level. One of DEBUG, INFO, WARNING, ERROR, and CRITICAL (case-insensitive).",
)
@click.option(
"--feature-store-yaml",
"-f",
help=f"Override the directory where the CLI should look for the feature_store.yaml file. Can also be set via the {FEAST_FS_YAML_FILE_PATH_ENV_NAME} environment variable.",
)
@click.pass_context
defcli(
ctx: click.Context,
chdir: Optional[str],
log_level: str,
feature_store_yaml: Optional[str],
):
"""
Feast CLI
For more information, see our public docs at https://docs.feast.dev/
help="Materialize all available data using current datetime as event timestamp (useful when source data lacks event timestamps)",
)
@click.option(
"--version",
"feature_view_version",
default=None,
help="Version to materialize (e.g., 'v2'). Requires --views with exactly one feature view.",
)
@click.pass_context
defmaterialize_command(
ctx: click.Context,
start_ts: Optional[str],
end_ts: Optional[str],
views: List[str],
disable_event_timestamp: bool,
feature_view_version: Optional[str],
):
"""
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 registered Feature
Views will be materialized.
START_TS and END_TS should be in ISO 8601 format, e.g. '2021-07-16T19:20:01'
If --disable-event-timestamp is used, timestamps are not required and all available data will be materialized using the current datetime as the event timestamp.
"""
store=create_feature_store(ctx)
ifdisable_event_timestamp:
ifstart_tsorend_ts:
raiseclick.UsageError(
"Cannot specify START_TS or END_TS when --disable-event-timestamp is used"
)
now=datetime.now()
# Query all available data and use current datetime as event timestamp
start_date=datetime(
1970, 1, 1
) # Beginning of time to capture all historical data
end_date=now
else:
ifnotstart_tsornotend_ts:
raiseclick.UsageError(
"START_TS and END_TS are required unless --disable-event-timestamp is used"