Skip to content

Commit

Permalink
feat:get and delete use schema cache
Browse files Browse the repository at this point in the history
Signed-off-by: Xianhui.Lin <[email protected]>
  • Loading branch information
JsDove committed Feb 5, 2025
1 parent c5a3c18 commit ec728ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pymilvus/client/grpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,11 @@ def _prepare_row_insert_request(
schema_timestamp=schema_timestamp,
)

def get_schema_from_cache_or_remote(
self, collection_name: str, schema: Optional[dict] = None, timeout: Optional[float] = None
):
return self._get_schema_from_cache_or_remote(collection_name, schema, timeout)

def _get_schema_from_cache_or_remote(
self, collection_name: str, schema: Optional[dict] = None, timeout: Optional[float] = None
):
Expand Down
6 changes: 4 additions & 2 deletions pymilvus/milvus_client/milvus_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ def get(

conn = self._get_connection()
try:
schema_dict = conn.describe_collection(collection_name, timeout=timeout, **kwargs)
schema_dict, _ = conn.get_schema_from_cache_or_remote(collection_name, timeout=timeout)
except Exception as ex:
logger.error("Failed to describe collection: %s", collection_name)
raise ex from ex
Expand Down Expand Up @@ -796,7 +796,9 @@ def delete(
conn = self._get_connection()
if len(pks) > 0:
try:
schema_dict = conn.describe_collection(collection_name, timeout=timeout, **kwargs)
schema_dict, _ = conn.get_schema_from_cache_or_remote(
collection_name, timeout=timeout
)
except Exception as ex:
logger.error("Failed to describe collection: %s", collection_name)
raise ex from ex
Expand Down

0 comments on commit ec728ac

Please sign in to comment.