feat: Add multiple entity support to dbt integration by YassinNouh21 · Pull Request #5901 · feast-dev/feast
- Update CLI to accept multiple -e flags for entity columns - Update mapper and codegen for multiple entities - Update documentation with examples and usage This extends the dbt integration to support FeatureViews with multiple entities, enabling use cases like transaction features keyed by both user_id and merchant_id. Fixes feast-dev#5872 Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
When creating entities from dbt models with integer columns, entities were being created with default ValueType.STRING, causing validation errors: "Entity X has type ValueType.STRING, which does not match the inferred type Int64" Solution: Added mapping dict and helper function for clean type conversion: - FEAST_TYPE_TO_VALUE_TYPE: Maps FeastType to ValueType - feast_type_to_value_type(): Helper function for conversion - _infer_entity_value_type(): Method in DbtToFeastMapper class This replaces verbose if-else chains with a clean dictionary lookup pattern. Also corrects schema generation to include entity columns, as FeatureView.__init__ expects to extract entity columns from the schema itself (lines 216-234 in feature_view.py). Changes: - feast/cli/dbt_import.py: Use mapper's _infer_entity_value_type() method - feast/dbt/mapper.py: Add type mapping dict and helper method Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
Updated test_mapper.py to use new parameter names: - entity_column -> entity_columns (accepts both str and List[str]) - result["entity"] -> result["entities"] (now returns list) Tests now correctly check for list of entities returned by create_all_from_model(). Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
YassinNouh21 added a commit to YassinNouh21/feast that referenced this pull request
* feat: Add multiple entity support to dbt integration - Update CLI to accept multiple -e flags for entity columns - Update mapper and codegen for multiple entities - Update documentation with examples and usage This extends the dbt integration to support FeatureViews with multiple entities, enabling use cases like transaction features keyed by both user_id and merchant_id. Fixes feast-dev#5872 Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com> * fix: Infer entity value types from dbt column types When creating entities from dbt models with integer columns, entities were being created with default ValueType.STRING, causing validation errors: "Entity X has type ValueType.STRING, which does not match the inferred type Int64" Solution: Added mapping dict and helper function for clean type conversion: - FEAST_TYPE_TO_VALUE_TYPE: Maps FeastType to ValueType - feast_type_to_value_type(): Helper function for conversion - _infer_entity_value_type(): Method in DbtToFeastMapper class This replaces verbose if-else chains with a clean dictionary lookup pattern. Also corrects schema generation to include entity columns, as FeatureView.__init__ expects to extract entity columns from the schema itself (lines 216-234 in feature_view.py). Changes: - feast/cli/dbt_import.py: Use mapper's _infer_entity_value_type() method - feast/dbt/mapper.py: Add type mapping dict and helper method Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com> * fix: Update unit tests for multi-entity parameter changes Updated test_mapper.py to use new parameter names: - entity_column -> entity_columns (accepts both str and List[str]) - result["entity"] -> result["entities"] (now returns list) Tests now correctly check for list of entities returned by create_all_from_model(). Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com> --------- Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
YassinNouh21 added a commit to YassinNouh21/feast that referenced this pull request
* feat: Add multiple entity support to dbt integration - Update CLI to accept multiple -e flags for entity columns - Update mapper and codegen for multiple entities - Update documentation with examples and usage This extends the dbt integration to support FeatureViews with multiple entities, enabling use cases like transaction features keyed by both user_id and merchant_id. Fixes feast-dev#5872 Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com> * fix: Infer entity value types from dbt column types When creating entities from dbt models with integer columns, entities were being created with default ValueType.STRING, causing validation errors: "Entity X has type ValueType.STRING, which does not match the inferred type Int64" Solution: Added mapping dict and helper function for clean type conversion: - FEAST_TYPE_TO_VALUE_TYPE: Maps FeastType to ValueType - feast_type_to_value_type(): Helper function for conversion - _infer_entity_value_type(): Method in DbtToFeastMapper class This replaces verbose if-else chains with a clean dictionary lookup pattern. Also corrects schema generation to include entity columns, as FeatureView.__init__ expects to extract entity columns from the schema itself (lines 216-234 in feature_view.py). Changes: - feast/cli/dbt_import.py: Use mapper's _infer_entity_value_type() method - feast/dbt/mapper.py: Add type mapping dict and helper method Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com> * fix: Update unit tests for multi-entity parameter changes Updated test_mapper.py to use new parameter names: - entity_column -> entity_columns (accepts both str and List[str]) - result["entity"] -> result["entities"] (now returns list) Tests now correctly check for list of entities returned by create_all_from_model(). Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com> --------- Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
jyejare pushed a commit to opendatahub-io/feast that referenced this pull request
* feat: Add multiple entity support to dbt integration - Update CLI to accept multiple -e flags for entity columns - Update mapper and codegen for multiple entities - Update documentation with examples and usage This extends the dbt integration to support FeatureViews with multiple entities, enabling use cases like transaction features keyed by both user_id and merchant_id. Fixes feast-dev#5872 Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com> * fix: Infer entity value types from dbt column types When creating entities from dbt models with integer columns, entities were being created with default ValueType.STRING, causing validation errors: "Entity X has type ValueType.STRING, which does not match the inferred type Int64" Solution: Added mapping dict and helper function for clean type conversion: - FEAST_TYPE_TO_VALUE_TYPE: Maps FeastType to ValueType - feast_type_to_value_type(): Helper function for conversion - _infer_entity_value_type(): Method in DbtToFeastMapper class This replaces verbose if-else chains with a clean dictionary lookup pattern. Also corrects schema generation to include entity columns, as FeatureView.__init__ expects to extract entity columns from the schema itself (lines 216-234 in feature_view.py). Changes: - feast/cli/dbt_import.py: Use mapper's _infer_entity_value_type() method - feast/dbt/mapper.py: Add type mapping dict and helper method Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com> * fix: Update unit tests for multi-entity parameter changes Updated test_mapper.py to use new parameter names: - entity_column -> entity_columns (accepts both str and List[str]) - result["entity"] -> result["entities"] (now returns list) Tests now correctly check for list of entities returned by create_all_from_model(). Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com> --------- Signed-off-by: yassinnouh21 <yassinnouh21@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters