Skip to content

Commit

Permalink
Fix idempotence of Collection (#1965)
Browse files Browse the repository at this point in the history
Signed-off-by: zhenshan.cao <[email protected]>
  • Loading branch information
czs007 authored Mar 12, 2024
1 parent 6df511f commit 67a4f50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 5 additions & 3 deletions pymilvus/client/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def __pack(self, raw: Any):
self.is_primary = raw.is_primary_key
self.description = raw.description
self.auto_id = raw.autoID
self.type = raw.data_type
self.type = DataType(raw.data_type)
self.is_partition_key = raw.is_partition_key
self.element_type = raw.element_type
self.element_type = DataType(raw.element_type)
try:
self.is_dynamic = raw.is_dynamic
except Exception:
Expand Down Expand Up @@ -82,9 +82,11 @@ def dict(self):
"description": self.description,
"type": self.type,
"params": self.params or {},
"element_type": self.element_type,
}

if self.element_type:
_dict["element_type"] = self.element_type

if self.is_partition_key:
_dict["is_partition_key"] = True
if self.is_dynamic:
Expand Down
6 changes: 2 additions & 4 deletions pymilvus/orm/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,12 @@ def enable_dynamic_field(self, value: bool):
self._enable_dynamic_field = bool(value)

def to_dict(self):
_dict = {
return {
"auto_id": self.auto_id,
"description": self._description,
"fields": [s.to_dict() for s in self._fields],
"enable_dynamic_field": self.enable_dynamic_field,
}
if self._enable_dynamic_field is not None:
_dict["enable_dynamic_field"] = self.enable_dynamic_field
return _dict

def verify(self):
# final check, detect obvious problems
Expand Down

0 comments on commit 67a4f50

Please sign in to comment.