Returns a copy of this base feature view with the feature view projection set to the given projection. Args: feature_view_projection: The feature view projection to assign to the copy. Raises: ValueError: The name or features of the projecti
(self, feature_view_projection: FeatureViewProjection)
| 254 | self.projection = feature_view_projection |
| 255 | |
| 256 | def with_projection(self, feature_view_projection: FeatureViewProjection): |
| 257 | """ |
| 258 | Returns a copy of this base feature view with the feature view projection set to |
| 259 | the given projection. |
| 260 | |
| 261 | Args: |
| 262 | feature_view_projection: The feature view projection to assign to the copy. |
| 263 | |
| 264 | Raises: |
| 265 | ValueError: The name or features of the projection do not match. |
| 266 | """ |
| 267 | if feature_view_projection.name != self.name: |
| 268 | raise ValueError( |
| 269 | f"The projection for the {self.name} FeatureView cannot be applied because it differs in name. " |
| 270 | f"The projection is named {feature_view_projection.name} and the name indicates which " |
| 271 | "FeatureView the projection is for." |
| 272 | ) |
| 273 | |
| 274 | for feature in feature_view_projection.features: |
| 275 | if feature not in self.features: |
| 276 | raise ValueError( |
| 277 | f"The projection for {self.name} cannot be applied because it contains {feature.name} which the " |
| 278 | "FeatureView doesn't have." |
| 279 | ) |
| 280 | |
| 281 | cp = self.__copy__() |
| 282 | cp.projection = feature_view_projection |
| 283 | |
| 284 | return cp |
no test coverage detected