### Install Python Dependencies Source: https://github.com/feast-dev/feast/blob/master/examples/credit-risk-end-to-end/README.md Install the necessary Python packages for the example using pip. Ensure your virtual environment is activated. ```bash pip install -r requirements.txt ``` -------------------------------- ### Basic Permission Setup Examples Source: https://github.com/feast-dev/feast/blob/master/docs/reference/auth/kubernetes_auth_setup.md Demonstrates setting up various permission types including role-based, group-based, namespace-based, and combined policies for Feast resources. These permissions can be applied via `feast apply`. ```python from feast.feast_object import ALL_RESOURCE_TYPES from feast.permissions.action import READ, AuthzedAction, ALL_ACTIONS from feast.permissions.permission import Permission from feast.permissions.policy import ( RoleBasedPolicy, GroupBasedPolicy, NamespaceBasedPolicy, CombinedGroupNamespacePolicy ) # Role-based permission role_perm = Permission( name="role_permission", types=ALL_RESOURCE_TYPES, policy=RoleBasedPolicy(roles=["reader-role"]), actions=[AuthzedAction.DESCRIBE] + READ ) # Group-based permission (new) data_team_perm = Permission( name="data_team_permission", types=ALL_RESOURCE_TYPES, policy=GroupBasedPolicy(groups=["data-team", "ml-engineers"]), actions=[AuthzedAction.DESCRIBE] + READ ) # Namespace-based permission (new) prod_perm = Permission( name="production_permission", types=ALL_RESOURCE_TYPES, policy=NamespaceBasedPolicy(namespaces=["production"]), actions=[AuthzedAction.DESCRIBE] + READ ) # Combined permission (new) dev_staging_perm = Permission( name="dev_staging_permission", types=ALL_RESOURCE_TYPES, policy=CombinedGroupNamespacePolicy( groups=["dev-team"], namespaces=["staging"] ), actions=ALL_ACTIONS ) ``` -------------------------------- ### Install Dependencies Source: https://github.com/feast-dev/feast/blob/master/infra/website/README.md Installs project dependencies using npm. Run this before starting the development server. ```bash npm install ``` -------------------------------- ### Initialize and Setup Feast Project Source: https://github.com/feast-dev/feast/blob/master/sdk/python/feast/templates/pytorch_nlp/README.md Initializes a new Feast project with the pytorch_nlp template and installs necessary dependencies. ```bash # Create new project feast init my-sentiment-demo -t pytorch_nlp cd my-sentiment-demo # Install dependencies pip install torch>=2.0.0 transformers>=4.30.0 # Navigate to feature repository cd feature_repo ``` -------------------------------- ### Install Feast Feature Server in Different Modes Source: https://github.com/feast-dev/feast/blob/master/infra/charts/feast-feature-server/README.md Examples for installing the Feast Feature Server in various deployment modes. Ensure you have a base64 encoded feature_store.yaml file ready. ```bash helm install feast-feature-server feast-charts/feast-feature-server --set feature_store_yaml_base64=$(base64 > feature_store.yaml) ``` ```bash helm install feast-offline-server feast-charts/feast-feature-server --set feast_mode=offline --set feature_store_yaml_base64=$(base64 > feature_store.yaml) ``` ```bash helm install feast-ui-server feast-charts/feast-feature-server --set feast_mode=ui --set feature_store_yaml_base64=$(base64 > feature_store.yaml) ``` ```bash helm install feast-registry-server feast-charts/feast-feature-server --set feast_mode=registry --set feature_store_yaml_base64=$(base64 > feature_store.yaml) ``` -------------------------------- ### Run Registry Server in Different Modes Source: https://github.com/feast-dev/feast/blob/master/docs/reference/feature-servers/registry-server.md Examples of how to start the registry server in its three supported modes: gRPC only, REST + gRPC, and REST only. ```bash feast serve_registry ``` ```bash feast serve_registry --rest-api ``` ```bash feast serve_registry --rest-api --no-grpc ``` -------------------------------- ### Start and Create Redis Cluster Source: https://github.com/feast-dev/feast/blob/master/docs/how-to-guides/adding-or-reusing-tests.md Use these commands to start a local Redis cluster for testing purposes. Ensure Redis is installed and accessible in your PATH. ```bash ./infra/scripts/redis-cluster.sh start ./infra/scripts/redis-cluster.sh create ``` -------------------------------- ### Install Colima and Kubectl Source: https://github.com/feast-dev/feast/blob/master/examples/operator-quickstart/01-Install.ipynb Installs the Colima container runtime and kubectl CLI on macOS. Starts Colima with specified configurations for a local Kubernetes environment. ```bash brew install colima kubectl colima start -r containerd -k -m 3 -d 100 -c 2 --cpu-type max -a x86_64 colima list ``` -------------------------------- ### Install KServe Source: https://github.com/feast-dev/feast/blob/master/infra/website/docs/blog/kubeflow-fraud-detection-e2e.md Installs KServe by creating a namespace, setting it as the current context, and running the quick installation script. Remember to switch back to the Kubeflow namespace afterwards. ```bash kubectl create namespace kserve kubectl config set-context --current --namespace=kserve curl -s "https://raw.githubusercontent.com/kserve/kserve/release-0.15/hack/quick_install.sh" | bash kubectl config set-context --current --namespace=kubeflow ``` -------------------------------- ### Start Milvus Containers with Docker Compose Source: https://github.com/feast-dev/feast/blob/master/examples/online_store/milvus_tutorial/README.md Use this command to start the Milvus server, etcd, and MinIO containers. Ensure Docker is installed and running. ```bash docker compose up -d ``` -------------------------------- ### Navigate to Example Directory Source: https://github.com/feast-dev/feast/blob/master/examples/mcp_feature_store/README.md Change your current directory to the MCP feature store example within the Feast repository. ```bash cd examples/mcp_feature_store ``` -------------------------------- ### Redis Online Store Creator Example Source: https://github.com/feast-dev/feast/blob/master/docs/how-to-guides/customizing-feast/adding-support-for-a-new-online-store.md Example of an OnlineStoreCreator for a Redis online store, including container start, log waiting, and stop. ```python class RedisOnlineStoreCreator(OnlineStoreCreator): def __init__(self, project_name: str, **kwargs): super().__init__(project_name) def create_online_store(self) -> Dict[str, str]: self.container.start() log_string_to_wait_for = "Ready to accept connections" wait_for_logs( container=self.container, predicate=log_string_to_wait_for, timeout=10 ) self.container.stop() ``` -------------------------------- ### Running Feast Agent Demo Source: https://github.com/feast-dev/feast/blob/master/infra/website/docs/blog/feast-agents-mcp.md Clone the Feast repository and navigate to the agent example directory. Execute the './run_demo.sh' script to start the demo, optionally providing an OpenAI API key for live LLM integration. ```bash git clone https://github.com/feast-dev/feast.git cd feast/examples/agent_feature_store ./run_demo.sh # demo mode (no API key needed) OPENAI_API_KEY=sk-... ./run_demo.sh # live LLM tool-calling ``` -------------------------------- ### Start the React App Source: https://github.com/feast-dev/feast/blob/master/ui/README.md Command to start the React development server after setting up Feast UI. ```bash // Start the React App yarn start ``` -------------------------------- ### Install Feast Source: https://github.com/feast-dev/feast/blob/master/docs/blog/feast-0-10-announcement.md Install the Feast library using pip. This is the first step to using Feast. ```bash pip install feast ``` -------------------------------- ### Initialize Feast NLP Project Template Source: https://github.com/feast-dev/feast/blob/master/docs/reference/alpha-static-artifacts.md This command initializes a new Feast project using the PyTorch NLP template, which includes a complete example of static artifact loading for sentiment analysis. It then navigates to the feature repository and starts the Feast server. ```bash feast init my-nlp-project -t pytorch_nlp cd my-nlp-project/feature_repo feast serve ``` -------------------------------- ### Install Feast Helm Chart Source: https://github.com/feast-dev/feast/blob/master/infra/charts/feast/README.md Install the Feast Helm chart with a release name of 'feast-release'. ```bash helm install feast-release feast-charts/feast ``` -------------------------------- ### Start Feature Transformation Server Source: https://github.com/feast-dev/feast/blob/master/sdk/python/docs/source/feast.md Starts a local server specifically for feature transformations. ```python serve_transformations(port=6006) ``` -------------------------------- ### Install Feast with OpenLineage Support Source: https://github.com/feast-dev/feast/blob/master/examples/openlineage-integration/README.md Install the Feast library with the OpenLineage integration package. This is a prerequisite for running the demo. ```bash pip install feast[openlineage] ``` -------------------------------- ### Generate Sample Data Source: https://github.com/feast-dev/feast/blob/master/examples/agent_feature_store/README.md Run the setup script to generate customer profiles, knowledge base articles with embeddings, and an agent memory scaffold. ```bash cd examples/agent_feature_store python setup_data.py ``` -------------------------------- ### Get Popular Tags API Examples Source: https://github.com/feast-dev/feast/blob/master/docs/reference/feature-servers/registry-server.md Examples of how to call the GET /api/v1/metrics/popular_tags endpoint to discover Feature Views by popular tags. Supports filtering by project and custom limits. ```bash curl -H "Authorization: Bearer " \ "http://localhost:6572/api/v1/metrics/popular_tags" ``` ```bash curl -H "Authorization: Bearer " \ "http://localhost:6572/api/v1/metrics/popular_tags?project=my_project" ``` ```bash curl -H "Authorization: Bearer " \ "http://localhost:6572/api/v1/metrics/popular_tags?project=my_project&limit=3" ``` -------------------------------- ### Run OpenLineage Integration Example Source: https://github.com/feast-dev/feast/blob/master/infra/website/docs/blog/feast-openlineage-integration.md Steps to run the end-to-end OpenLineage integration example. Requires Marquez to be running first. ```bash # Start Marquez first docker run -p 5000:5000 -p 3000:3000 marquezproject/marquez # Clone and run the example cd feast/examples/openlineage-integration python openlineage_demo.py --url http://localhost:5000 # View lineage at http://localhost:3000 ``` -------------------------------- ### Example OpenTelemetry Configuration Source: https://github.com/feast-dev/feast/blob/master/docs/getting-started/components/open-telemetry.md An example configuration snippet showing how to enable metrics and set the OpenTelemetry Collector endpoint. ```yaml metrics: enabled: true otelCollector: endpoint: "otel-collector.default.svc.cluster.local:4317" ``` -------------------------------- ### Install Feast with Hybrid Offline Store Dependencies Source: https://github.com/feast-dev/feast/blob/master/docs/reference/offline-stores/hybrid.md Install Feast with all required offline store dependencies for the stores you plan to use. This example shows installation for Spark and Snowflake. ```bash pip install 'feast[spark,snowflake]' ``` -------------------------------- ### View Feast Init Help Source: https://github.com/feast-dev/feast/blob/master/sdk/python/feast/templates/milvus/README.md Display available templates and options for initializing a new Feast project. ```bash feast init --help ``` -------------------------------- ### Install Feast with Online Store Dependencies Source: https://github.com/feast-dev/feast/blob/master/docs/reference/online-stores/hybrid.md Install Feast with the necessary dependencies for all online stores you plan to use with the HybridOnlineStore. For example, to use GCP and Cassandra, install 'feast[gcp,cassandra]'. ```bash pip install 'feast[gcp,cassandra]' ``` -------------------------------- ### Feast Server TLS Output Example Source: https://github.com/feast-dev/feast/blob/master/docs/how-to-guides/starting-feast-servers-tls-mode.md Example output when starting a Feast server in TLS mode, indicating the server is serving over HTTPS. ```text 11/07/2024 11:10:01 AM feast.offline_server INFO: Found SSL certificates in the args so going to start offline server in TLS(SSL) mode. 11/07/2024 11:10:01 AM feast.offline_server INFO: Offline store server serving at: grpc+tls://127.0.0.1:8815 11/07/2024 11:10:01 AM feast.offline_server INFO: offline server starting with pid: [11606] ``` ```text INFO: Started server process [78872] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on https://0.0.0.0:8888 (Press CTRL+C to quit) ``` -------------------------------- ### serve_ui Source: https://github.com/feast-dev/feast/blob/master/sdk/python/docs/source/index.md Starts the UI server locally. ```APIDOC ## serve_ui(host: str, port: int, get_registry_dump: Callable, registry_ttl_sec: int, root_path: str = '', tls_key_path: str = '', tls_cert_path: str = '') -> None Start the UI server locally ``` -------------------------------- ### Install Feast with Qdrant Support Source: https://github.com/feast-dev/feast/blob/master/docs/reference/alpha-vector-database.md Installs the Feast package with Qdrant integration. This command is for setting up Feast to connect with Qdrant. ```bash pip install feast[qdrant] ``` -------------------------------- ### Start UI Server Source: https://github.com/feast-dev/feast/blob/master/sdk/python/docs/source/source/feast.md Launch the UI server locally using `serve_ui`. This requires a callable for `get_registry_dump` and configuration for port, root path, and TLS. ```python serve_ui(host='localhost', port=9090, get_registry_dump=get_registry_dump) ``` -------------------------------- ### Startup Model Loading (Optimized) Source: https://github.com/feast-dev/feast/blob/master/sdk/python/feast/templates/pytorch_nlp/README.md Illustrates the optimized approach of loading a model once at server startup. ```python # ✅ Model loads once at server startup def sentiment_prediction(inputs): global _sentiment_model # Pre-loaded model return _sentiment_model(inputs["text"]) ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/feast-dev/feast/blob/master/examples/credit-risk-end-to-end/README.md Use these commands to create a virtual environment for the example and activate it. This helps isolate project dependencies. ```bash # create venv-example virtual environment python -m venv venv-example # activate environment source venv-example/bin/activate ``` -------------------------------- ### Build and Run Go Feature Server Source: https://github.com/feast-dev/feast/blob/master/go/README.md Build the Go Feature Server executable and start it as an HTTP or gRPC server. Ensure a feature_store.yaml file is present for configuration. ```bash go build -o feast-go ./go/main.go ``` ```bash ./feast-go --type=http --port=8080 --metrics-port=9090 ``` ```bash #./feast-go --type=grpc --port=[your-choice] --metrics-port=9091 ``` -------------------------------- ### Install SQLAlchemy dialect for external databases (Shell) Source: https://github.com/feast-dev/feast/blob/master/docs/reference/registries/sql.md When using a database with an external dialect not directly supported by SQLAlchemy, install the corresponding SQLAlchemy dialect package using pip. This example shows installation for CockroachDB. ```shell pip install sqlalchemy-cockroachdb ``` -------------------------------- ### start_server Source: https://github.com/feast-dev/feast/blob/master/sdk/python/docs/source/source/modules.md Starts the feature server. ```APIDOC ## start_server() ### Description Starts the feature server. ### Method `start_server` ### Parameters This function does not explicitly list parameters in the provided source. Refer to the Feast SDK for detailed parameter information. ``` -------------------------------- ### Multi-Version Materialization Workflow Example (CLI) Source: https://github.com/feast-dev/feast/blob/master/docs/rfcs/feature-view-versioning.md Demonstrates materializing data for multiple versions of the same feature view to support different models. This allows models to query their respective versions online. ```bash # Model A uses v1, Model B uses v2 — populate both tables feast materialize --views driver_stats --version v1 2024-01-01T00:00:00 2024-02-01T00:00:00 feast materialize --views driver_stats --version v2 2024-01-01T00:00:00 2024-02-01T00:00:00 # Models can now query their respective versions online # Model A: store.get_online_features(features=["driver_stats@v1:trips_today"], ...) # Model B: store.get_online_features(features=["driver_stats@v2:trips_today"], ...) ``` -------------------------------- ### Get Torch Module Source: https://github.com/feast-dev/feast/blob/master/sdk/python/docs/source/feast.md Retrieves the torch module if available. Raises an error if torch is not installed or CUDA libraries are missing. ```APIDOC ## feast.torch_wrapper.get_torch() ### Description Return the torch module if available, else raise a friendly error. This prevents crashing on import if CUDA libs are missing. ### Returns `torch` module if available. ``` -------------------------------- ### Initialize and Serve Feature Repository Source: https://github.com/feast-dev/feast/blob/master/docs/reference/feature-servers/python-feature-server.md Demonstrates the steps to initialize a new Feast feature repository, apply configurations, materialize data, and start the feature server. ```bash $ feast init feature_repo Creating a new Feast repository in /home/tsotne/feast/feature_repo. $ cd feature_repo $ feast apply Created entity driver Created feature view driver_hourly_stats Created feature service driver_activity Created sqlite table feature_repo_driver_hourly_stats $ feast materialize-incremental $(date +%Y-%m-%d) Materializing 1 feature views to 2021-09-09 17:00:00-07:00 into the sqlite online store. driver_hourly_stats from 2021-09-09 16:51:08-07:00 to 2021-09-09 17:00:00-07:00: 100%|████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 295.24it/s] $ feast serve 09/10/2021 10:42:11 AM INFO:Started server process [8889] INFO: Waiting for application startup. 09/10/2021 10:42:11 AM INFO:Waiting for application startup. INFO: Application startup complete. 09/10/2021 10:42:11 AM INFO:Application startup complete. INFO: Uvicorn running on http://127.0.0.1:6566 (Press CTRL+C to quit) 09/10/2021 10:42:11 AM INFO:Uvicorn running on http://127.0.0.1:6566 (Press CTRL+C to quit) ``` -------------------------------- ### Configure Local Registry Source: https://github.com/feast-dev/feast/blob/master/docs/reference/registries/local.md Example configuration for a local registry in feature_store.yaml. This setup is intended for experimentation and specifies a local file path for the registry and a Dask offline store. ```yaml project: feast_local registry: path: registry.pb cache_ttl_seconds: 60 online_store: null offline_store: type: dask ``` -------------------------------- ### Start Feast Feature Servers with Podman Compose Source: https://github.com/feast-dev/feast/blob/master/examples/podman_local/README.md Launches the necessary containers for online, offline, and registry feature servers. Ensure Podman Compose is installed and the docker-compose.yml file is present. ```bash podman-compose up -d ``` -------------------------------- ### Example feature_store.yaml Source: https://github.com/feast-dev/feast/blob/master/docs/reference/feature-repository/feature-store-yaml.md This is a basic example of a feature_store.yaml file. It specifies the project name, registry location, provider, and online store configuration. ```yaml project: loyal_spider registry: data/registry.db provider: local online_store: type: sqlite path: data/online_store.db ``` -------------------------------- ### serve_ui Source: https://github.com/feast-dev/feast/blob/master/sdk/python/docs/index.md Starts the UI server locally, requiring a registry dump callable and port configuration, with optional TLS. ```APIDOC ## serve_ui(host: str, port: int, get_registry_dump: Callable, registry_ttl_sec: int, root_path: str = '', tls_key_path: str = '', tls_cert_path: str = '') -> None ### Description Start the UI server locally. ### Parameters * **host** – The host address to bind the server to. * **port** – The port number to bind the server to. * **get_registry_dump** – A callable that returns the registry dump. * **registry_ttl_sec** – Time-to-live for registry entries in seconds. * **root_path** – The root path for the UI server. Defaults to ''. * **tls_key_path** – Path to the TLS key file for HTTPS. * **tls_cert_path** – Path to the TLS certificate file for HTTPS. ``` -------------------------------- ### Production Feature Store Configuration (GCP) Source: https://github.com/feast-dev/feast/blob/master/sdk/python/feast/templates/pytorch_nlp/README.md Example `feature_store.yaml` configuration for deploying the feature store on GCP production. This setup requires a Redis server for the online store and BigQuery for the offline store. ```yaml # feature_store.yaml for GCP production (requires cloud services) project: sentiment_analysis_prod provider: gcp registry: gs://my-bucket/feast/registry.pb online_store: type: redis # Requires separate Redis server connection_string: redis://my-redis-cluster:6379 offline_store: type: bigquery project_id: my-gcp-project ``` -------------------------------- ### Production Feature Store Configuration (AWS) Source: https://github.com/feast-dev/feast/blob/master/sdk/python/feast/templates/pytorch_nlp/README.md Example `feature_store.yaml` configuration for deploying the feature store on AWS production. This setup requires a Redis server for the online store and BigQuery for the offline store. ```yaml # feature_store.yaml for AWS production (requires Redis setup) project: sentiment_analysis_prod provider: aws registry: s3://my-bucket/feast/registry.pb online_store: type: redis # Requires separate Redis server connection_string: redis://my-redis-cluster:6379 offline_store: type: bigquery project_id: my-gcp-project ``` -------------------------------- ### FeastInitOptions Source: https://github.com/feast-dev/feast/blob/master/infra/feast-operator/docs/api/markdown/ref.md FeastInitOptions defines how to run a `feast init` command. ```APIDOC ## FeastInitOptions ### Description FeastInitOptions defines how to run a `feast init`. ### Fields - `minimal` (boolean): If true, initializes a minimal Feast project. - `template` (string): Template for the created project. ``` -------------------------------- ### serve_ui Source: https://github.com/feast-dev/feast/blob/master/sdk/python/docs/source/feast.md Starts the UI server locally, providing a web interface for interacting with the feature store. Requires a callable for registry dump and other configurations. ```APIDOC ## serve_ui ### Description Start the UI server locally. ### Method `serve_ui` ### Parameters #### Path Parameters None #### Query Parameters * **host** (str) - Required - The host address to bind the server to. * **port** (int) - Required - The port number to listen on. * **get_registry_dump** (Callable) - Required - A callable function to get the registry dump. * **registry_ttl_sec** (int) - Required - Time-to-live for registry entries in seconds. * **root_path** (str) - Optional - The root path for the UI. Defaults to ''. * **tls_key_path** (str) - Optional - Path to the TLS key file for HTTPS. * **tls_cert_path** (str) - Optional - Path to the TLS certificate file for HTTPS. ### Response None ``` -------------------------------- ### RAG Query Example with Feast and Sentence Transformers Source: https://github.com/feast-dev/feast/blob/master/infra/website/docs/blog/feast-ray-distributed-processing.md Demonstrates retrieving similar documents using Feast's online store with a query embedding generated by SentenceTransformer. Requires Feast and SentenceTransformer to be installed. ```python from feast import FeatureStore from sentence_transformers import SentenceTransformer # Initialize feature store store = FeatureStore(repo_path=".") # Generate query embedding model = SentenceTransformer("all-MiniLM-L6-v2") query_embedding = model.encode(["sci-fi movie about space"])[0].tolist() # Retrieve similar documents results = store.retrieve_online_documents_v2( features=[ "document_embeddings:embedding", "document_embeddings:movie_name", "document_embeddings:movie_director", ], query=query_embedding, top_k=5, ).to_dict() # Display results for i in range(len(results["document_id_pk"])): print(f"{i+1}. {results['movie_name'][i]}") print(f" Director: {results['movie_director'][i]}") print(f" Distance: {results['distance'][i]:.3f}") ``` -------------------------------- ### Run Demo Script Source: https://github.com/feast-dev/feast/blob/master/examples/agent_feature_store/README.md Execute the main demo script. Set OPENAI_API_KEY for live LLM tool-calling. ```bash cd examples/agent_feature_store ./run_demo.sh # Or with live LLM tool-calling: OPENAI_API_KEY=sk-... ./run_demo.sh ``` -------------------------------- ### Get Online Features Using Feature Service Source: https://github.com/feast-dev/feast/blob/master/docs/how-to-guides/federated-feature-store.md Retrieve online features for training or inference by referencing a FeatureService name. This example demonstrates fetching features for a specific entity row, including both platform and team-defined features. ```python # In team's training or inference code from feast import FeatureStore store = FeatureStore(repo_path=".") # Get online features using team's feature service features = store.get_online_features( features="team_marketing_campaign_model", entity_rows=[ {"customer_id": "C123", "current_cart_value": 150.0} ], ).to_dict() print(features) # Output includes both platform features and team's ODFV: # { # "customer_id": ["C123"], # "total_purchases": [42], # "avg_order_value": [125.50], # "purchase_propensity_score": [42.3] # } ``` -------------------------------- ### Dockerfile for Containerized Deployment with Static Artifacts Source: https://github.com/feast-dev/feast/blob/master/docs/reference/alpha-static-artifacts.md This Dockerfile demonstrates how to include static artifacts in your container image for Feast. It copies the requirements, installs dependencies, copies the feature repository (including static artifacts), and sets the command to start the Feast server. ```dockerfile FROM python:3.11-slim # Install dependencies COPY requirements.txt . RUN pip install -r requirements.txt # Copy feature repository including static_artifacts.py COPY feature_repo/ /app/feature_repo/ WORKDIR /app/feature_repo # Start feature server CMD ["feast", "serve", "--host", "0.0.0.0"] ``` -------------------------------- ### Scheduled Materialization with Airflow Source: https://github.com/feast-dev/feast/blob/master/docs/how-to-guides/running-feast-in-production.md Use the PythonOperator in Airflow to schedule Feast materialization jobs. Ensure the Feast Python SDK is installed and the feature repository is synced. This example demonstrates how to materialize feature views incrementally, with an option to let Airflow manage materialization state and include an overlap for late data. ```python from airflow.decorators import task from feast import RepoConfig, FeatureStore from feast.infra.online_stores.dynamodb import DynamoDBOnlineStoreConfig from feast.repo_config import RegistryConfig # Define Python callable @task() def materialize(data_interval_start=None, data_interval_end=None): repo_config = RepoConfig( registry=RegistryConfig(path="s3://[YOUR BUCKET]/registry.pb"), project="feast_demo_aws", provider="aws", offline_store="file", online_store=DynamoDBOnlineStoreConfig(region="us-west-2"), entity_key_serialization_version=3 ) store = FeatureStore(config=repo_config) # Option 1: materialize just one feature view # store.materialize_incremental(datetime.datetime.now(), feature_views=["my_fv_name"]) # Option 2: materialize all feature views incrementally # store.materialize_incremental(datetime.datetime.now()) # Option 3: Let Airflow manage materialization state # Add 1 hr overlap to account for late data store.materialize(data_interval_start.subtract(hours=1), data_interval_end) ``` -------------------------------- ### Initialize Feast Project with Ray Template Source: https://github.com/feast-dev/feast/blob/master/docs/reference/offline-stores/ray.md Use the `feast init -t ray` command to quickly set up a new Feast project with pre-configured Ray offline store and compute engine. ```bash feast init -t ray my_ray_project cd my_ray_project/feature_repo ``` -------------------------------- ### Install MongoDB Extra Source: https://github.com/feast-dev/feast/blob/master/docs/reference/online-stores/mongodb.md Install the MongoDB extra for Feast. Ensure you also install the dependency for your chosen offline store. ```bash pip install 'feast[mongodb]' ``` -------------------------------- ### Bootstrap a New Feast Project Source: https://github.com/feast-dev/feast/blob/master/docs/getting-started/quickstart.md Use the `feast init` command to create a new feature repository. Navigate into the created directory to begin configuration. ```bash feast init my_project cd my_project/feature_repo ``` -------------------------------- ### Install Milvus Extra Source: https://github.com/feast-dev/feast/blob/master/docs/reference/online-stores/milvus.md Install the Milvus extra for Feast. Ensure you also install the dependency for your chosen offline store. ```bash pip install 'feast[milvus]' ``` -------------------------------- ### Install Feast Source: https://github.com/feast-dev/feast/blob/master/examples/quickstart/quickstart.ipynb Install the Feast library using pip. A runtime restart is recommended after installation to ensure correct dependency loading. ```python %%sh pip install feast -U -q echo "Please restart your runtime now (Runtime -> Restart runtime). This ensures that the correct dependencies are loaded." ``` -------------------------------- ### FeatureStore.serve() Source: https://github.com/feast-dev/feast/blob/master/sdk/python/docs/source/modules.md Starts a feature server to serve features online. ```APIDOC ## FeatureStore.serve() ### Description Starts a feature server that serves features online. This allows real-time retrieval of feature values. ### Method ```python FeatureStore.serve(port: int = 6006) ``` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **port** (int) - Optional - The port on which to run the feature server. Defaults to 6006. ``` -------------------------------- ### serve_ui Source: https://github.com/feast-dev/feast/blob/master/sdk/python/docs/source/source/feast.md Starts the UI server locally, providing a web interface for interacting with the feature store. ```APIDOC ## serve_ui ### Description Start the UI server locally. ### Method Signature `serve_ui(host: str, port: int, get_registry_dump: Callable, registry_ttl_sec: int, root_path: str = '', tls_key_path: str = '', tls_cert_path: str = '') -> None` ### Parameters * **host** (str) - Required - The host address to bind the server to. * **port** (int) - Required - The port number to listen on. * **get_registry_dump** (Callable) - Required - A callable function to get the registry dump. * **registry_ttl_sec** (int) - Required - The time-to-live for registry entries in seconds. * **root_path** (str) - Optional - The root path for the UI server. Defaults to ''. * **tls_key_path** (str) - Optional - Path to the TLS key file. * **tls_cert_path** (str) - Optional - Path to the TLS certificate file. ``` -------------------------------- ### Install Feast with dbt support Source: https://github.com/feast-dev/feast/blob/master/docs/how-to-guides/dbt-integration.md Install Feast with the dbt integration package. Alternatively, install the dbt artifacts parser directly. ```bash pip install 'feast[dbt]' ``` ```bash pip install dbt-artifacts-parser ``` -------------------------------- ### Install Oracle Extras Source: https://github.com/feast-dev/feast/blob/master/docs/reference/offline-stores/oracle.md Install the Oracle extras for Feast to enable Oracle offline store functionality. This command installs the necessary dependencies. ```bash pip install 'feast[oracle]' ``` -------------------------------- ### Start Registry Server Source: https://github.com/feast-dev/feast/blob/master/sdk/python/docs/source/source/feast.md Start the registry server locally using `serve_registry`. Configure the port and optionally enable the REST API. ```python serve_registry(port=6604) ``` -------------------------------- ### Install OpenTelemetry Operator Source: https://github.com/feast-dev/feast/blob/master/docs/getting-started/components/open-telemetry.md Apply the OpenTelemetry operator YAML file to install the operator. Ensure cert-manager is installed and pods are running beforehand. ```bash kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml ``` -------------------------------- ### Install Feast MCP Support Source: https://github.com/feast-dev/feast/blob/master/docs/getting-started/genai.md Install Feast with MCP support using pip. This command installs the necessary packages to enable MCP functionality. ```bash pip install feast[mcp] ``` -------------------------------- ### Initialize a Feast Project Source: https://github.com/feast-dev/feast/blob/master/skills/SKILL.md Use this command to create a new Feast project directory with a basic configuration. ```bash feast init my_project cd my_project feast apply ``` -------------------------------- ### Install Prerequisites for MacOS Source: https://github.com/feast-dev/feast/blob/master/examples/kind-quickstart/01-Install.ipynb Installs and configures necessary tools like Colima, Kind, Helm, kubectl, and yq on a MacOS environment. Ensure you have Homebrew installed. ```bash brew install colima colima start brew install kind kind create cluster --name feast kind start brew install helm brew install kubectl kubectl config use-context kind-feast brew install yq ``` -------------------------------- ### Agent Demo Mode: SSO Setup and Memory Recall Source: https://github.com/feast-dev/feast/blob/master/examples/agent_feature_store/README.md Simulates agent reasoning for an enterprise customer asking about SSO, including memory recall and customer lookup. Demonstrates memory continuity when the customer returns. ```text ================================================================= Scene 1: Enterprise customer (C1001) asks about SSO Customer: C1001 | Query: "How do I set up SSO for my team?" ================================================================= [Demo mode] Simulating agent reasoning Round 1 | recall_memory(customer_id=C1001) -> No prior interactions found Round 1 | lookup_customer(customer_id=C1001) -> Alice Johnson | enterprise plan | $24,500 spend | 1 open tickets Round 1 | search_knowledge_base(query="How do I set up SSO for my team?...") -> Best match: "Configuring single sign-on (SSO)" Round 2 | Generating personalised response... ───────────────────────────────────────────────────────────── Agent Response: ───────────────────────────────────────────────────────────── Hi Alice! Since you're on our Enterprise plan, SSO is available for your team. Go to Settings > Security > SSO and enter your Identity Provider metadata URL. We support SAML 2.0 and OIDC... [Checkpoint] Memory saved: topic="SSO setup" ================================================================= Scene 4: C1001 returns -- does the agent remember Scene 1? Customer: C1001 | Query: "I'm back about my SSO question from earlier." ================================================================= [Demo mode] Simulating agent reasoning Round 1 | recall_memory(customer_id=C1001) -> Previous topic: SSO setup -> Open issue: none -> Interaction count: 1 Round 1 | lookup_customer(customer_id=C1001) -> Alice Johnson | enterprise plan | $24,500 spend | 1 open tickets Round 2 | Generating personalised response... ───────────────────────────────────────────────────────────── Agent Response: ───────────────────────────────────────────────────────────── Welcome back, Alice! I can see from our records that we last discussed "SSO setup". How can I help you today? [Checkpoint] Memory saved: topic="SSO setup" ``` -------------------------------- ### Install scikit-learn (if needed) Source: https://github.com/feast-dev/feast/blob/master/docs/tutorials/azure/README.md If you encounter issues during the model training stage, install or reinstall scikit-learn version 0.22.1. After installation, restart the kernel and resume the tutorial. ```python !pip install scikit-learn==0.22.1 ``` -------------------------------- ### Example .feastignore File Source: https://github.com/feast-dev/feast/blob/master/docs/reference/feast-ignore.md This example demonstrates various patterns that can be used in a .feastignore file to exclude specific files, directories, and file types from being processed by `feast apply`. ```text # Ignore virtual environment venv ``` ```text # Ignore a specific Python file scripts/foo.py ``` ```text # Ignore all Python files directly under scripts directory scripts/*.py ``` ```text # Ignore all "foo.py" anywhere under scripts directory scripts/**/foo.py ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/feast-dev/feast/blob/master/docs/project/development-guide.md Installs pre-commit and its associated hooks to automatically lint and format the codebase on commit. Ensure Python 3.10+ and uv are installed first. ```sh make install-precommit ``` -------------------------------- ### Start Ray Cluster for Feast Source: https://github.com/feast-dev/feast/blob/master/docs/reference/offline-stores/ray.md Instructions for starting a Ray cluster for distributed data access with Feast. This includes starting the head node and configuring worker nodes. ```bash ray start --head --port=10001 ``` ```bash # On worker nodes ray start --address='head-node-ip:10001' ``` -------------------------------- ### Initialize Feast Project with Cassandra Provider Source: https://github.com/feast-dev/feast/blob/master/docs/reference/online-stores/scylladb.md Create a new Feast project configured to use Cassandra as the online store provider. This sets up the basic project structure. ```bash feast init REPO_NAME -t cassandra ``` -------------------------------- ### Initialize Feast with GCP Template Source: https://github.com/feast-dev/feast/blob/master/sdk/python/feast/templates/milvus/README.md Start a new Feast project using the Google Cloud Platform template for a scalable offline store. ```bash feast init -t gcp ``` -------------------------------- ### Install PostgreSQL using Helm Source: https://github.com/feast-dev/feast/blob/master/examples/operator-postgres-tls-demo/01-Install-postgres-tls-using-helm.ipynb Installs the PostgreSQL chart from Bitnami using Helm, applying the custom TLS and authentication configurations defined in 'values.yaml'. The installation is performed in the 'feast' namespace. ```bash !helm install postgresql bitnami/postgresql --version 16.4.9 -f values.yaml -n feast ``` -------------------------------- ### FeatureView Initialization Example Source: https://github.com/feast-dev/feast/blob/master/sdk/python/docs/source/source/index.md This example demonstrates how to initialize a FeatureView with various configurations, including name, source, entities, TTL, and online/offline settings. It's useful for defining a logical group of features for data retrieval and management. ```python from datetime import timedelta from feast import FeatureView, ValueType, Entity, Feature, FileSource # Define entities user = Entity(name="user_id", value_type=ValueType.INT64, description="unique user identifier") # Define feature view user_profile_fv = FeatureView( name="user_profile", entities=[user], ttl=timedelta(days=1), online=True, offline=False, schema=[ Feature(name="name", value_type=ValueType.STRING), Feature(name="age", value_type=ValueType.INT64), ], source=FileSource(path="/path/to/user_profile.parquet") ) ``` -------------------------------- ### Install pypdf Package Source: https://github.com/feast-dev/feast/blob/master/examples/rag-docling/docling-demo.ipynb Installs the pypdf library, which is required for PDF processing. ```python ! pip install pypdf ``` -------------------------------- ### Install OpenLineage Dependency Source: https://github.com/feast-dev/feast/blob/master/docs/reference/openlineage.md Install the OpenLineage Python package or Feast with the OpenLineage extra. ```bash pip install openlineage-python ``` ```bash pip install feast[openlineage] ```