Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

Commit

Permalink
Construct partition without check (#248)
Browse files Browse the repository at this point in the history
Signed-off-by: dragondriver <[email protected]>
  • Loading branch information
longjiquan authored Jul 9, 2021
1 parent be6c6e6 commit e44268b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pymilvus_orm/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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=""):
"""
Expand Down
2 changes: 2 additions & 0 deletions pymilvus_orm/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e44268b

Please sign in to comment.