milvus-logo
LFAI
< Docs
  • Python

grant()

This method grants privileges to the current role.

Invocation

grant(object, object_name, privilege)

Parameters

ParameterDescriptionTypeRequired
objectType of the operational object to which the specified privilege belongs, such as Collection, Index, Partition, etc. This parameter is case-sensitive.StringTrue
object_nameName of the object to which the role is granted the specified prvilege.StringTrue
privilegeName of the privilege to be granted to the role. This parameter is case-sensitive.StringTrue

For details on applicable objects and privileges, refer to Users and Roles.

Return

No return

Example

from pymilvus import connections
from pymilvus.orm.role import Role
connections.connect()
role = Role(role_name)
role.grant("Collection", collection_name, "Insert")