Skip to content

featurebyte.UserProvidedColumn

class UserProvidedColumn(
*,
name: str,
dtype: DBVarType,
feature_type: FeatureType,
description: Optional[str]=None
)

Description

Defines a user-provided column that will be supplied in observation tables during feature materialization. These columns can be accessed as Features through the Context.

User-provided columns allow you to incorporate external data (such as customer-provided information or real-time inputs) into your feature engineering workflow without requiring them to be stored in source tables.

Parameters

  • name: str
    The name of the column. This must match the column name that will be provided in the observation table during materialization.

  • dtype: DBVarType
    The data type of the column (e.g., DBVarType.FLOAT, DBVarType.INT,
    DBVarType.VARCHAR).

  • feature_type: FeatureType
    The semantic type of the feature (e.g., FeatureType.NUMERIC,
    FeatureType.CATEGORICAL, FeatureType.TIMESTAMP).

  • description: Optional[str]
    A description of the column for documentation purposes.

Examples

Create a context with user-provided columns:

context = fb.Context.create(
    name="loan_application_context",
    primary_entity=["customer"],
    user_provided_columns=[
        fb.UserProvidedColumn(
            name="annual_income",
            dtype=fb.DBVarType.FLOAT,
            feature_type=fb.FeatureType.NUMERIC,
            description="Customer's self-reported annual income",
        ),
        fb.UserProvidedColumn(
            name="employment_status",
            dtype=fb.DBVarType.VARCHAR,
            feature_type=fb.FeatureType.CATEGORICAL,
        ),
    ],
)

Access user-provided columns as features:

income_feature = context.get_user_provided_feature("annual_income")

See Also