{"id":4358,"library":"feast","title":"Feast Feature Store","description":"Feast is an open-source feature store that enables data scientists and engineers to productionize machine learning features. It provides a consistent way to define, manage, and serve features for both model training (historical data) and online inference (low-latency serving). Feast is actively maintained, with new releases typically occurring monthly.","status":"active","version":"0.62.0","language":"en","source_language":"en","source_url":"https://github.com/feast-dev/feast","tags":["feature store","mlops","machine learning","data engineering","feature management"],"install":[{"cmd":"pip install 'feast[local]'","lang":"bash","label":"Basic installation for local development"},{"cmd":"pip install 'feast[aws]' # or feast[gcp], feast[azure], feast[spark], etc.","lang":"bash","label":"Installation with specific cloud/data platform providers"}],"dependencies":[{"reason":"Requires Python 3.10.0 or higher.","package":"python","optional":false},{"reason":"Often required for data serialization and interaction with data sources, implicitly installed with most providers.","package":"pyarrow","optional":true},{"reason":"Used for feature dataframes, especially in local and testing environments.","package":"pandas","optional":true}],"imports":[{"symbol":"FeatureStore","correct":"from feast import FeatureStore"},{"symbol":"Entity","correct":"from feast import Entity"},{"symbol":"FeatureView","correct":"from feast import FeatureView"},{"symbol":"Field","correct":"from feast import Field"},{"symbol":"ValueType","correct":"from feast import ValueType"},{"symbol":"FileSource","correct":"from feast.infra.offline_stores.file_source import FileSource"},{"note":"RepoConfig was directly under feast in older versions (pre-0.20), moved to top-level __init__ in recent versions for convenience.","wrong":"from feast.repo_config import RepoConfig","symbol":"RepoConfig","correct":"from feast import RepoConfig"}],"quickstart":{"code":"import pandas as pd\nimport os\nimport shutil\nfrom feast import FeatureStore, Entity, FeatureView, Field, ValueType\nfrom feast.infra.offline_stores.file_source import FileSource\n\n# --- 1. Define feature repository structure and data ---\n\n# Create a dummy feature_repo directory for the quickstart\nrepo_path = \"feature_repo\"\nif not os.path.exists(repo_path): os.makedirs(repo_path)\n\n# Create a dummy feature_store.yaml inside the repo_path\nwith open(os.path.join(repo_path, \"feature_store.yaml\"), \"w\") as f:\n    f.write(\"project: default_project\\n\")\n    f.write(\"provider: local\\n\")\n    f.write(\"registry: data/registry.db\\n\")\n    f.write(\"online_store:\\n\")\n    f.write(\"    type: sqlite\\n\")\n    f.write(\"    path: data/online_store.db\\n\")\n    f.write(\"offline_store:\\n\")\n    f.write(\"    type: local\\n\")\n\n# Create dummy data for our feature view\nuser_df = pd.DataFrame({\n    \"user_id\": [1001, 1002, 1003, 1004],\n    \"age\": [25, 30, 22, 35],\n    \"city\": [\"NYC\", \"SF\", \"LA\", \"Chicago\"],\n    \"event_timestamp\": [pd.Timestamp(\"2023-01-01\", tz=\"UTC\"), pd.Timestamp(\"2023-01-02\", tz=\"UTC\"), pd.Timestamp(\"2023-01-03\", tz=\"UTC\"), pd.Timestamp(\"2023-01-04\", tz=\"UTC\")]\n})\n\n# Simulate writing to a file source within the repo for cleanliness\nuser_data_path = os.path.join(repo_path, \"user_data.parquet\")\nuser_df.to_parquet(user_data_path)\n\n# Define an Entity\nuser = Entity(name=\"user_id\", description=\"User ID\", value_type=ValueType.INT64)\n\n# Define an Offline FileSource\nuser_features_source = FileSource(\n    path=user_data_path,\n    timestamp_field=\"event_timestamp\"\n)\n\n# Define a FeatureView\nuser_feature_view = FeatureView(\n    name=\"user_profile\",\n    entities=[user],\n    ttl=pd.Timedelta(days=365),\n    schema=[\n        Field(name=\"age\", value_type=ValueType.INT64),\n        Field(name=\"city\", value_type=ValueType.STRING),\n    ],\n    source=user_features_source\n)\n\n# --- 2. Initialize and apply FeatureStore ---\n\n# Initialize FeatureStore by pointing to the repository path\nfs = FeatureStore(repo_path=repo_path)\n\n# Apply (register) the feature definitions programmatically\n# This simulates `feast apply` CLI command.\nfs.apply([user, user_feature_view])\n\n# --- 3. Get historical features ---\n\n# Create an entity_df for historical feature retrieval\nentity_df = pd.DataFrame({\n    \"user_id\": [1001, 1002, 1003, 1004],\n    \"event_timestamp\": [pd.Timestamp(\"2023-01-05\", tz=\"UTC\"), pd.Timestamp(\"2023-01-05\", tz=\"UTC\"), pd.Timestamp(\"2023-01-05\", tz=\"UTC\"), pd.Timestamp(\"2023-01-05\", tz=\"UTC\")]\n})\n\nhistorical_features = fs.get_historical_features(\n    entity_df=entity_df,\n    feature_views=[user_feature_view],\n).to_df()\n\nprint(\"Historical features:\\n\", historical_features)\n\n# --- 4. Get online features ---\n\n# Before getting online features, you might need to materialize data\n# to the online store. For 'local' provider with 'sqlite' online store,\n# materialization populates the sqlite database.\nfs.materialize_incremental(end_date=pd.Timestamp.now(tz=\"UTC\"))\n\nonline_features = fs.get_online_features(\n    features=[ \"user_profile:age\", \"user_profile:city\" ],\n    entity_rows=[{\"user_id\": 1001}, {\"user_id\": 1002}]\n).to_dict()\n\nprint(\"Online features:\\n\", online_features)\n\n# --- 5. Clean up generated files (optional) ---\nshutil.rmtree(repo_path)\n","lang":"python","description":"This quickstart demonstrates how to define entities and feature views, set up a local Feast repository programmatically, and then retrieve both historical and online features. In a typical Feast workflow, `feature_store.yaml` and feature definitions (`feature_repo.py`) are managed as files in a `feature_repo` directory, and the `feast apply` CLI command is used to register them. This example simulates the necessary file structure and programmatic application for a runnable Python script, followed by cleanup."},"warnings":[{"fix":"Consult the official Feast migration guides for your specific version upgrade (e.g., on the Feast documentation website). Always test upgrades in a staging environment.","message":"Feast versions, especially in the 0.x series, often introduce breaking changes to the Python API, CLI, and `feature_store.yaml` schema. Always review release notes when upgrading.","severity":"breaking","affected_versions":"All 0.x versions (e.g., 0.1 to 0.62)"},{"fix":"Install Feast with the required provider group, e.g., `pip install 'feast[aws]'`, `pip install 'feast[gcp]'`, or `pip install 'feast[spark,local]'`. Refer to the Feast documentation for a complete list of provider groups.","message":"Feast requires provider-specific dependencies for connecting to various offline and online stores (e.g., AWS, GCP, Azure, Spark, Snowflake). These are not installed by default with `pip install feast`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `feature_store.yaml` is in the directory where your script is run, or explicitly pass `repo_path` to `FeatureStore(repo_path=\"./my_feature_repo/\")`. For production, it's recommended to define a dedicated feature repository directory.","message":"The `FeatureStore` constructor expects a `repo_path` pointing to a directory containing `feature_store.yaml` and your feature definition files (`.py`). If not specified, it defaults to the current working directory, which can lead to `FileNotFoundError` or unexpected behavior.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Explicitly define `path` for file-based `registry` and `online_store` types in your `feature_store.yaml` configuration.","message":"For local development with the 'local' provider, `registry` and `online_store` types (e.g., `sqlite`) should specify persistent file paths in `feature_store.yaml` (e.g., `registry: data/registry.db`, `online_store: type: sqlite`, `path: data/online_store.db`) to avoid losing definitions or online features between sessions.","severity":"gotcha","affected_versions":"All versions using 'local' provider"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}