Skip to content

Commit

Permalink
Ignore unsupported fields when deserializing `QueryFieldsExperimentRe…
Browse files Browse the repository at this point in the history
…sult` from proto
  • Loading branch information
kgodlewski committed Sep 19, 2024
1 parent bbe09af commit 351bcf2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/neptune/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,18 @@ class QueryFieldsExperimentResult:
object_key: str
fields: List[Field]

# Any field the type of which is not in this set will not be
# returned to the user. Applies to protobuf calls only.
PROTO_SUPPORTED_FIELD_TYPES = {
FieldType.STRING.value,
FieldType.BOOL.value,
FieldType.INT.value,
FieldType.FLOAT.value,
FieldType.DATETIME.value,
FieldType.STRING_SET.value,
FieldType.FLOAT_SERIES.value,
}

@staticmethod
def from_dict(data: Dict[str, Any]) -> QueryFieldsExperimentResult:
return QueryFieldsExperimentResult(
Expand All @@ -655,7 +667,11 @@ def from_proto(data: Any) -> QueryFieldsExperimentResult:
return QueryFieldsExperimentResult(
object_id=data.experimentId,
object_key=data.experimentShortId,
fields=[Field.from_proto(field) for field in data.attributes],
fields=[
Field.from_proto(field)
for field in data.attributes
if field.type in QueryFieldsExperimentResult.PROTO_SUPPORTED_FIELD_TYPES
],
)


Expand Down

0 comments on commit 351bcf2

Please sign in to comment.