(
self,
*,
name: str,
mode: Union[TransformationMode, str] = TransformationMode.PYTHON,
source: Optional[
Union[DataSource, "BatchFeatureView", List["BatchFeatureView"]]
] = None,
sink_source: Optional[DataSource] = None,
entities: Optional[List[Entity]] = None,
ttl: Optional[timedelta] = None,
tags: Optional[Dict[str, str]] = None,
online: bool = False,
offline: bool = False,
description: str = "",
owner: str = "",
org: str = "",
schema: Optional[List[Field]] = None,
udf: Optional[Callable[[Any], Any]] = None,
udf_string: Optional[str] = "",
feature_transformation: Optional[Transformation] = None,
batch_engine: Optional[Dict[str, Any]] = None,
aggregations: Optional[List[Aggregation]] = None,
enable_validation: bool = False,
version: str = "latest",
)
| 78 | aggregations: Optional[List[Aggregation]] |
| 79 | |
| 80 | def __init__( |
| 81 | self, |
| 82 | *, |
| 83 | name: str, |
| 84 | mode: Union[TransformationMode, str] = TransformationMode.PYTHON, |
| 85 | source: Optional[ |
| 86 | Union[DataSource, "BatchFeatureView", List["BatchFeatureView"]] |
| 87 | ] = None, |
| 88 | sink_source: Optional[DataSource] = None, |
| 89 | entities: Optional[List[Entity]] = None, |
| 90 | ttl: Optional[timedelta] = None, |
| 91 | tags: Optional[Dict[str, str]] = None, |
| 92 | online: bool = False, |
| 93 | offline: bool = False, |
| 94 | description: str = "", |
| 95 | owner: str = "", |
| 96 | org: str = "", |
| 97 | schema: Optional[List[Field]] = None, |
| 98 | udf: Optional[Callable[[Any], Any]] = None, |
| 99 | udf_string: Optional[str] = "", |
| 100 | feature_transformation: Optional[Transformation] = None, |
| 101 | batch_engine: Optional[Dict[str, Any]] = None, |
| 102 | aggregations: Optional[List[Aggregation]] = None, |
| 103 | enable_validation: bool = False, |
| 104 | version: str = "latest", |
| 105 | ): |
| 106 | if not flags_helper.is_test(): |
| 107 | warnings.warn( |
| 108 | "Batch feature views are experimental features in alpha development. " |
| 109 | "Some functionality may still be unstable so functionality can change in the future.", |
| 110 | RuntimeWarning, |
| 111 | ) |
| 112 | |
| 113 | if isinstance(source, DataSource) and ( |
| 114 | type(source).__name__ not in SUPPORTED_BATCH_SOURCES |
| 115 | and source.to_proto().type != DataSourceProto.SourceType.CUSTOM_SOURCE |
| 116 | ): |
| 117 | raise ValueError( |
| 118 | f"Batch feature views need a batch source, expected one of {SUPPORTED_BATCH_SOURCES} " |
| 119 | f"or CUSTOM_SOURCE, got {type(source).__name__}: {source.name} instead " |
| 120 | ) |
| 121 | |
| 122 | if source is None and aggregations: |
| 123 | raise ValueError( |
| 124 | "BatchFeatureView with aggregations requires a source to aggregate from." |
| 125 | ) |
| 126 | |
| 127 | if ( |
| 128 | source is None |
| 129 | and not udf |
| 130 | and not feature_transformation |
| 131 | and not aggregations |
| 132 | ): |
| 133 | raise ValueError( |
| 134 | "BatchFeatureView requires at least one of: source, udf, feature_transformation, or aggregations." |
| 135 | ) |
| 136 | |
| 137 | self.mode = mode |
nothing calls this directly
no test coverage detected