tecton.declarative.FeatureService

class tecton.declarative.FeatureService(*, name, description=None, tags=None, owner=None, online_serving_enabled=True, features=None, logging=None)

Declare a FeatureService.

In Tecton, a Feature Service exposes an API for accessing a set of FeatureViews. FeatureServices are implemented using the FeatureService class.

Once deployed in production, each model has one associated Feature Service that serves the model its features. A Feature Service contains a list of the Feature Views associated with a model. It also includes user-provided metadata such as name, description, and owner that Tecton uses to organize feature data.

Methods

__init__

Instantiates a new FeatureService.

__init__(*, name, description=None, tags=None, owner=None, online_serving_enabled=True, features=None, logging=None)

Instantiates a new FeatureService.

Parameters
  • name (str) – A unique name for the Feature Service.

  • description (Optional[str]) – A human-readable description.

  • tags (Optional[Dict[str, str]]) – Tags associated with this Tecton Object (key-value pairs of arbitrary metadata).

  • owner (Optional[str]) – Owner name (typically the email of the primary maintainer).

  • online_serving_enabled (bool) – (Optional, default True) If True, users can send realtime requests to this FeatureService, and only FeatureViews with online materialization enabled can be added to this FeatureService.

  • features (Optional[List[Union[FeaturesConfig, FeatureDefinition]]]) – The list of FeatureView or FeaturesConfig that this FeatureService will serve.

  • logging (Optional[LoggingConfig]) – A configuration for logging feature requests sent to this Feature Service.

An example of Feature Service declaration

from tecton import FeatureService, LoggingConfig
# Import your feature views declared in your feature repo directory
from feature_repo.features.feature_views import last_transaction_amount_sql, transaction_amount_is_high
...

# Declare Feature Service
fraud_detection_feature_service = FeatureService(
    name='fraud_detection_feature_service',
    description='A FeatureService providing features for a model that predicts if a transaction is fraudulent.',
    features=[
        last_transaction_amount_sql,
        transaction_amount_is_high,
        ...
    ]
    logging=LoggingConfig(
        sample_rate=0.5,
        log_effective_times=False,
    )
    tags={'release': 'staging'},
)

Attributes

name

Name of this FeatureService.