granted = hc.grant_user_permission("user_name", ["all"], "table_name", "database_name")
Result:
This method returns a Boolean value to represent whether this operation is successful. If the error pops up when granting privilege, “ValueError” exception will be raised.
Parameter description:
Parameters | Description | Required |
---|---|---|
user_name (str) | User to whom will be granted privileges | Yes |
privileges (list[str]) | Privilege list, including “create”, “access”, “all” | Yes |
table_name (str) | Table name | No, grants privileges on "default" database if not specified. If user does not have privilege on "default" database, “ValueError” exception will be raised |
database_name (str) | Database where the table is created | No, defaults to "default" database |