diff --git a/pymilvus_orm/collection.py b/pymilvus_orm/collection.py index a8c1589..b2aec36 100644 --- a/pymilvus_orm/collection.py +++ b/pymilvus_orm/collection.py @@ -666,7 +666,7 @@ def partitions(self) -> list: partition_strs = conn.list_partitions(self._name) partitions = [] for partition in partition_strs: - partitions.append(Partition(self, partition)) + partitions.append(Partition(self, partition, construct_only=True)) return partitions def partition(self, partition_name) -> Partition: @@ -698,7 +698,7 @@ def partition(self, partition_name) -> Partition: """ if self.has_partition(partition_name) is False: return None - return Partition(self, partition_name) + return Partition(self, partition_name, construct_only=True) def create_partition(self, partition_name, description=""): """ diff --git a/pymilvus_orm/partition.py b/pymilvus_orm/partition.py index fe5e96d..b531182 100644 --- a/pymilvus_orm/partition.py +++ b/pymilvus_orm/partition.py @@ -31,6 +31,8 @@ def __init__(self, collection, name, description="", **kwargs): self._kwargs = kwargs conn = self._get_connection() + if kwargs.get("construct_only", False): + return has = conn.has_partition(self._collection.name, self._name) if not has: conn.create_partition(self._collection.name, self._name)