Skip to content

Commit

Permalink
[Feature Store] Making features/entities optional in feature-set spec (
Browse files Browse the repository at this point in the history
  • Loading branch information
theSaarco committed Apr 29, 2021
1 parent cda9cd7 commit e272b16
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions mlrun/api/db/sqldb/db.py
Expand Up @@ -1546,7 +1546,7 @@ def store_feature_set(
session, FeatureSet, project, name, tag, uid
)

feature_set_dict = feature_set.dict()
feature_set_dict = feature_set.dict(exclude_none=True)

if not existing_feature_set:
# Check if this is a re-tag of existing object - search by uid only
Expand Down Expand Up @@ -1600,7 +1600,7 @@ def _validate_and_enrich_record_for_creation(
get_project_member().ensure_project(session, project)
tag = new_object.metadata.tag or "latest"

object_dict = new_object.dict()
object_dict = new_object.dict(exclude_none=True)
hash_key = fill_object_hash(object_dict, "uid", tag)

if versioned:
Expand Down Expand Up @@ -1654,7 +1654,7 @@ def patch_feature_set(
f"Feature-set not found {feature_set_uri}"
)

feature_set_struct = feature_set_record.dict()
feature_set_struct = feature_set_record.dict(exclude_none=True)
# using mergedeep for merging the patch content into the existing dictionary
strategy = patch_mode.to_mergedeep_strategy()
mergedeep.merge(feature_set_struct, feature_set_update, strategy=strategy)
Expand Down Expand Up @@ -1832,7 +1832,7 @@ def store_feature_vector(
session, FeatureVector, project, name, tag, uid
)

feature_vector_dict = feature_vector.dict()
feature_vector_dict = feature_vector.dict(exclude_none=True)

if not existing_feature_vector:
# Check if this is a re-tag of existing object - search by uid only
Expand Down Expand Up @@ -1886,7 +1886,7 @@ def patch_feature_vector(
f"Feature-vector not found {feature_vector_uri}"
)

feature_vector_struct = feature_vector_record.dict()
feature_vector_struct = feature_vector_record.dict(exclude_none=True)
# using mergedeep for merging the patch content into the existing dictionary
strategy = patch_mode.to_mergedeep_strategy()
mergedeep.merge(feature_vector_struct, feature_vector_update, strategy=strategy)
Expand Down
4 changes: 2 additions & 2 deletions mlrun/api/schemas/feature_store.py
Expand Up @@ -31,8 +31,8 @@ class Config:


class FeatureSetSpec(ObjectSpec):
entities: List[Entity]
features: List[Feature]
entities: List[Entity] = []
features: List[Feature] = []


class FeatureSet(BaseModel):
Expand Down

0 comments on commit e272b16

Please sign in to comment.