Back to Feast

Feast CLI reference

docs/reference/feast-cli-commands.md

0.63.016.2 KB
Original Source

Feast CLI reference

Overview

The Feast CLI comes bundled with the Feast Python package. It is immediately available after installing Feast.

text
Usage: feast [OPTIONS] COMMAND [ARGS]...

  Feast CLI

  For more information, see our public docs at https://docs.feast.dev/

Options:
  -c, --chdir TEXT  Switch to a different feature repository directory before
                    executing the given subcommand.

  --help            Show this message and exit.

Commands:
  apply                    Create or update a feature store deployment
  configuration            Display Feast configuration
  delete                   Delete a Feast object from the registry
  entities                 Access entities
  feature-views            Access feature views
  init                     Create a new Feast repository
  materialize              Run a (non-incremental) materialization job to...
  materialize-incremental  Run an incremental materialization job to ingest...
  permissions              Access permissions
  registry-dump            Print contents of the metadata registry
  teardown                 Tear down deployed feature store infrastructure
  version                  Display Feast SDK version

Global Options

The Feast CLI provides one global top-level option that can be used with other commands

chdir (-c, --chdir)

This command allows users to run Feast CLI commands in a different folder from the current working directory.

text
feast -c path/to/my/feature/repo apply

Apply

Creates or updates a feature store deployment

bash
feast apply

Options:

  • --skip-source-validation: Skip validation of data sources (don't check if tables exist)
  • --skip-feature-view-validation: Skip validation of feature views. Use with caution as this skips important checks
bash
# Skip only data source validation
feast apply --skip-source-validation

# Skip only feature view validation
feast apply --skip-feature-view-validation

# Skip both validations
feast apply --skip-source-validation --skip-feature-view-validation

What does Feast apply do?

  1. Feast will scan Python files in your feature repository and find all Feast object definitions, such as feature views, entities, and data sources.
  2. Feast will validate your feature definitions (e.g. for uniqueness of features). This validation can be skipped using the --skip-feature-view-validation flag if the type/validation system is being overly strict.
  3. Feast will sync the metadata about Feast objects to the registry. If a registry does not exist, then it will be instantiated. The standard registry is a simple protobuf binary file that is stored on disk (locally or in an object store).
  4. Feast CLI will create all necessary feature store infrastructure. The exact infrastructure that is deployed or configured depends on the provider configuration that you have set in feature_store.yaml. For example, setting local as your provider will result in a sqlite online store being created.

{% hint style="info" %} The --skip-feature-view-validation flag is particularly useful for On-Demand Feature Views (ODFVs) with complex transformations that may fail validation. However, use it with caution and please report any validation issues to the Feast team on GitHub. {% endhint %}

{% hint style="warning" %} feast apply (when configured to use cloud provider like gcp or aws) will create cloud infrastructure. This may incur costs. {% endhint %}

{% hint style="info" %} Important: feast apply only registers or updates objects found in your Python files. It does not delete objects that you've removed from your code. To delete objects from the registry, you must use the feast delete command or explicit delete methods in the Python SDK. See the Delete command below and the Registry documentation for details. {% endhint %}

Configuration

Display the actual configuration being used by Feast, including both user-provided configurations and default configurations applied by Feast.

bash
feast configuration
yaml
project: foo
registry: data/registry.db
provider: local
online_store:
    type: sqlite
    path: data/online_store.db
offline_store: 
    type: dask 
entity_key_serialization_version: 3
auth:
    type: no_auth

Delete

Delete a Feast object from the registry by its name.

bash
feast delete <OBJECT_NAME>

What does feast delete do?

The feast delete command removes a Feast object (such as a feature view, entity, data source, feature service, etc.) from the registry. The command will:

  1. Search for the object by name across all object types (entities, feature views, feature services, data sources, saved datasets, validation references, etc.)
  2. Delete the first matching object found
  3. Remove any associated infrastructure

Example:

bash
# Delete a feature view named "driver_hourly_stats"
feast delete driver_hourly_stats

# Delete an entity named "driver"
feast delete driver

{% hint style="warning" %} The delete operation is permanent and will remove the object from the registry. Make sure you want to delete the object before running this command. {% endhint %}

{% hint style="info" %} If multiple objects have the same name across different types, feast delete will delete the first one it finds. For programmatic deletion with more control, use the Python SDK methods like store.delete_feature_view(), store.delete_feature_service(), etc. {% endhint %}

Entities

List all registered entities

text
feast entities list

Options:
  --tags TEXT  Filter by tags (e.g. --tags 'key:value' --tags 'key:value,
               key:value, ...'). Items return when ALL tags match.
text
NAME       DESCRIPTION    TYPE
driver_id  driver id      ValueType.INT64

Feature views

List all registered feature views

text
feast feature-views list

Options:
  --tags TEXT  Filter by tags (e.g. --tags 'key:value' --tags 'key:value,
               key:value, ...'). Items return when ALL tags match.
text
NAME                 ENTITIES    TYPE
driver_hourly_stats  {'driver'}  FeatureView

List version history for a feature view

text
feast feature-views list-versions FEATURE_VIEW_NAME
text
VERSION  TYPE          CREATED              VERSION_ID
v0       feature_view  2024-01-15 10:30:00  a1b2c3d4-...
v1       feature_view  2024-01-16 14:22:00  e5f6g7h8-...

Init

Creates a new feature repository

text
feast init my_repo_name
text
Creating a new Feast repository in /projects/my_repo_name.
text
.
├── data
│   └── driver_stats.parquet
├── example.py
└── feature_store.yaml

It's also possible to use other templates

text
feast init -t gcp my_feature_repo

or to set the name of the new project

text
feast init -t gcp my_feature_repo

Materialize

Load data from feature views into the online store.

With timestamps:

bash
feast materialize 2020-01-01T00:00:00 2022-01-01T00:00:00

Without timestamps (uses current datetime):

bash
feast materialize --disable-event-timestamp

Load data for specific feature views:

text
feast materialize -v driver_hourly_stats 2020-01-01T00:00:00 2022-01-01T00:00:00
text
feast materialize --disable-event-timestamp -v driver_hourly_stats

The --disable-event-timestamp flag is useful when your source data lacks event timestamp columns, allowing you to materialize all available data using the current datetime as the event timestamp.

text
Materializing 1 feature views from 2020-01-01 to 2022-01-01

driver_hourly_stats:
100%|██████████████████████████| 5/5 [00:00<00:00, 5949.37it/s]

Materialize incremental

Load data from feature views into the online store, beginning from either the previous materialize or materialize-incremental end date, or the beginning of time.

text
feast materialize-incremental 2022-01-01T00:00:00

Permissions

List permissions

List all registered permission

text
feast permissions list

Options:
  --tags TEXT    Filter by tags (e.g. --tags 'key:value' --tags 'key:value,
                 key:value, ...'). Items return when ALL tags match.
  -v, --verbose  Print the resources matching each configured permission
text
+-----------------------+-------------+-----------------------+-----------+----------------+-------------------------+
| NAME                  | TYPES       | NAME_PATTERNS         | ACTIONS   | ROLES          | REQUIRED_TAGS           |
+=======================+=============+=======================+===========+================+================+========+
| reader_permission1234 | FeatureView | transformed_conv_rate | DESCRIBE  | reader         | -                       |
|                       |             | driver_hourly_stats   | DESCRIBE  | reader         | -                       |
+-----------------------+-------------+-----------------------+-----------+----------------+-------------------------+
| writer_permission1234 | FeatureView | transformed_conv_rate | CREATE    | writer         | -                       |
+-----------------------+-------------+-----------------------+-----------+----------------+-------------------------+
| special               | FeatureView | special.*             | DESCRIBE  | admin          | test-key2 : test-value2 |
|                       |             |                       | UPDATE    | special-reader | test-key : test-value   |
+-----------------------+-------------+-----------------------+-----------+----------------+-------------------------+

verbose option describes the resources matching each configured permission:

text
feast permissions list -v
text
Permissions:

permissions
├── reader_permission1234 ['reader']
│   └── FeatureView: none
└── writer_permission1234 ['writer']
    ├── FeatureView: none
    │── OnDemandFeatureView: ['transformed_conv_rate_fresh', 'transformed_conv_rate']
    └── BatchFeatureView: ['driver_hourly_stats', 'driver_hourly_stats_fresh']

Describe a permission

Describes the provided permission

text
feast permissions describe permission-name
name: permission-name
types:
- FEATURE_VIEW
namePattern: transformed_conv_rate
requiredTags:
  required1: required-value1
  required2: required-value2
actions:
- DESCRIBE
policy:
  roleBasedPolicy:
    roles:
    - reader
tags:
  key1: value1
  key2: value2

Permission check

The permissions check command is used to identify resources that lack the appropriate permissions based on their type, name, or tags.

This command is particularly useful for administrators when roles, actions, or permissions have been modified or newly configured. By running this command, administrators can easily verify which resources and actions are not protected by any permission configuration, ensuring that proper security measures are in place.

text
> feast permissions check


The following resources are not secured by any permission configuration:
NAME                         TYPE
driver                       Entity
driver_hourly_stats_fresh    FeatureView
The following actions are not secured by any permission configuration (Note: this might not be a security concern, depending on the used APIs):
NAME                         TYPE                 UNSECURED ACTIONS
driver                       Entity               CREATE
                                                  DESCRIBE
                                                  UPDATE
                                                  DELETE
                                                  READ_ONLINE
                                                  READ_OFFLINE
                                                  WRITE_ONLINE
                                                  WRITE_OFFLINE
driver_hourly_stats_fresh    FeatureView          CREATE
                                                  DESCRIBE
                                                  UPDATE
                                                  DELETE
                                                  READ_ONLINE
                                                  READ_OFFLINE
                                                  WRITE_ONLINE
                                                  WRITE_OFFLINE

Based on the above results, the administrator can reassess the permissions configuration and make any necessary adjustments to meet their security requirements.

If no resources are accessible publicly, the permissions check command will return the following response:
> feast permissions check
The following resources are not secured by any permission configuration:
NAME    TYPE
The following actions are not secured by any permission configuration (Note: this might not be a security concern, depending on the used APIs):
NAME    TYPE    UNSECURED ACTIONS

List of the configured roles

List all the configured roles

text
feast permissions list-roles

Options:
  --verbose Print the resources and actions permitted to each configured
            role
text
ROLE NAME
admin
reader
writer

verbose option describes the resources and actions permitted to each managed role:

text
feast permissions list-roles -v
text
ROLE NAME          RESOURCE NAME               RESOURCE TYPE    PERMITTED ACTIONS
admin              driver_hourly_stats_source  FileSource       CREATE
                                                                DELETE
                                                                QUERY_OFFLINE
                                                                QUERY_ONLINE
                                                                DESCRIBE
                                                                UPDATE
admin              vals_to_add                 RequestSource    CREATE
                                                                DELETE
                                                                QUERY_OFFLINE
                                                                QUERY_ONLINE
                                                                DESCRIBE
                                                                UPDATE
admin              driver_stats_push_source    PushSource       CREATE
                                                                DELETE
                                                                QUERY_OFFLINE
                                                                QUERY_ONLINE
                                                                DESCRIBE
                                                                UPDATE
admin              driver_hourly_stats_source  FileSource       CREATE
                                                                DELETE
                                                                QUERY_OFFLINE
                                                                QUERY_ONLINE
                                                                DESCRIBE
                                                                UPDATE
admin              vals_to_add                 RequestSource    CREATE
                                                                DELETE
                                                                QUERY_OFFLINE
                                                                QUERY_ONLINE
                                                                DESCRIBE
                                                                UPDATE
admin              driver_stats_push_source    PushSource       CREATE
                                                                DELETE
                                                                QUERY_OFFLINE
                                                                QUERY_ONLINE
                                                                DESCRIBE
                                                                UPDATE
reader             driver_hourly_stats         FeatureView      DESCRIBE
reader             driver_hourly_stats_fresh   FeatureView      DESCRIBE
...

Teardown

Tear down deployed feature store infrastructure

text
feast teardown

Version

Print the current Feast version

text
feast version