MCPcopy Index your code
hub / github.com/feast-dev/feast / create_all_from_model

Method create_all_from_model

sdk/python/feast/dbt/mapper.py:413–480  ·  view source on GitHub ↗

Create all Feast objects (DataSource, Entity, FeatureView) from a dbt model. This is a convenience method that creates all necessary Feast objects in one call. Args: model: The DbtModel to create objects from entity_columns: Entity column na

(
        self,
        model: DbtModel,
        entity_columns: Union[str, List[str]],
        timestamp_field: Optional[str] = None,
        ttl_days: Optional[int] = None,
        exclude_columns: Optional[List[str]] = None,
        online: bool = True,
    )

Source from the content-addressed store, hash-verified

411 )
412
413 def create_all_from_model(
414 self,
415 model: DbtModel,
416 entity_columns: Union[str, List[str]],
417 timestamp_field: Optional[str] = None,
418 ttl_days: Optional[int] = None,
419 exclude_columns: Optional[List[str]] = None,
420 online: bool = True,
421 ) -> Dict[str, Union[List[Entity], Any, FeatureView]]:
422 """
423 Create all Feast objects (DataSource, Entity, FeatureView) from a dbt model.
424
425 This is a convenience method that creates all necessary Feast objects
426 in one call.
427
428 Args:
429 model: The DbtModel to create objects from
430 entity_columns: Entity column name(s) - single string or list of strings
431 timestamp_field: Override the default timestamp field
432 ttl_days: Override the default TTL in days
433 exclude_columns: Additional columns to exclude from features
434 online: Whether to enable online serving
435
436 Returns:
437 Dict with keys 'entities', 'data_source', 'feature_view'
438 """
439 # Normalize to list
440 entity_cols: List[str] = (
441 [entity_columns]
442 if isinstance(entity_columns, str)
443 else list(entity_columns)
444 )
445
446 # Create entities (plural)
447 entities_list = []
448 for entity_col in entity_cols:
449 entity_value_type = self._infer_entity_value_type(model, entity_col)
450 entity = self.create_entity(
451 name=entity_col,
452 description=f"Entity for {model.name}",
453 tags={"dbt.model": model.name},
454 value_type=entity_value_type,
455 )
456 entities_list.append(entity)
457
458 # Create data source
459 data_source = self.create_data_source(
460 model=model,
461 timestamp_field=timestamp_field,
462 )
463
464 # Create feature view
465 feature_view = self.create_feature_view(
466 model=model,
467 source=data_source,
468 entity_columns=entity_cols,
469 entities=entities_list,
470 timestamp_field=timestamp_field,

Calls 4

create_entityMethod · 0.95
create_data_sourceMethod · 0.95
create_feature_viewMethod · 0.95