milvus-logo
LFAI
< Docs
  • Python

list_grants()

This operation lists all privileges granted to the current role.

Request Syntax

list_grants(
    db_name: str
)

PARAMETERS:

  • db_name (str)

    The name of a database in which Milvus carries out this operation.

    If the specified database does not exist, an empty result returns.

RETURN TYPE:

GrantInfo

RETURNS:

A GrantInfo object that contains a list of GrantItem objects.

├── GrantInfo
│   └── groups  
│       └── GrantItem
│           ├── object
│           ├── object_name
│           ├── role_name
│           ├── grantor_name
│           ├── privilege
│           └── db_name

The GrantItem objects contains the following fields:

EXCEPTIONS:

  • MilvusException

    This exception will be raised when any error occurs during this operation.

Examples

from pymilvus import Role

# Get an existing role
role = Role(name="root")

# List all privileges granted to the current role.
res = list_grants(
    db_name="test_db"
)

Related operations

The following operations are related to get_replicas():