Skip to content

Commit

Permalink
fix describe database return type
Browse files Browse the repository at this point in the history
Signed-off-by: Xianhui.Lin <[email protected]>

databaseinfo add todict method

Signed-off-by: Xianhui.Lin <[email protected]>

fix rebase confict

Signed-off-by: Xianhui.Lin <[email protected]>

flatten the properties into describedb

Signed-off-by: Xianhui.Lin <[email protected]>

fix code format

Signed-off-by: Xianhui.Lin <[email protected]>
  • Loading branch information
JsDove committed Dec 17, 2024
1 parent 364da8b commit a869916
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pymilvus/client/grpc_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ def describe_database(self, db_name: str, timeout: Optional[float] = None):
request = Prepare.describe_database_req(db_name=db_name)
resp = self._stub.DescribeDatabase(request, timeout=timeout)
check_status(resp.status)
return DatabaseInfo(resp)
return DatabaseInfo(resp).to_dict()

@retry_on_rpc_failure()
def get_load_state(
Expand Down
6 changes: 6 additions & 0 deletions pymilvus/client/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,12 @@ def __init__(self, info: Any) -> None:
def __str__(self) -> str:
return f"DatabaseInfo(name={self.name}, properties={self.properties})"

def to_dict(self) -> Dict[str, Any]:
"""Converts the DatabaseInfo instance to a dictionary."""
result = {"name": self.name}
result.update(self.properties)
return result


class ExtraList(list):
"""
Expand Down

0 comments on commit a869916

Please sign in to comment.