Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Store] Making features/entities optional in feature-set spec #902

Merged
merged 4 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions mlrun/api/db/sqldb/db.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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