Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
can someone please suggest i have created the below script ,but using it i am only able to find the project name and project owner only for groups under permission it says
Script :
import dataiku
client = dataiku.api_client()
project_list = client.list_project_keys()
for projects in project_list:
dssproject = client.get_project(projects)
perm = dssproject.get_permissions()
owner_name = perm['owner']
group = perm['group']
print (projects+',', owner_name +',',group)
Error :
KeyError Traceback (most recent call last)
<ipython-input-23-85bbf5c840f7> in <module>
6 perm = dssproject.get_permissions()
7 owner_name = perm['owner']
----> 8 group = perm['group']
9 print (projects+',', owner_name +',',group)
KeyError: 'group'
can someone please suggest me the proper key or the proper script to fetch the groups under permission tab
Operating system used: LINUX ON PREM
Hi,
I see you mean the project permissions, not the owner permissions. Thanks for the clarification.
In that case, in your original script the error was the dictionary used. You need to use โdssproject.get_permissions()["permissionsโ]โ
The output will have the following format:
Hi Saurabh,
Information about user groups will not be found among the projectโs API methods. Instead we need to look into the users and groups API: https://doc.dataiku.com/dss/latest/python-api/users-groups.html#users-and-groups
This way we can query for each project owner which groups they belong to. For example (Depending on your DSS version the exact syntax may vary):
import dataiku
client=dataiku.api_client()
project_list=client.list_project_keys()
for projects in project_list:
dssproject = client.get_project(projects)
project_owner=dssproject.get_permissions()['owner']
user_groups = client.get_user(project_owner).get_settings().get_raw()['groups']
print("Project id: ",projects)
print("Project owner: ",project_owner)
print("Owner groups: ", user_groups)
@MiguelangelC thank you for the script
But i am not looking for the groups to which project owner is tagged but i am looking for the groups under the permission tab reference screenshot attached
Hi,
I see you mean the project permissions, not the owner permissions. Thanks for the clarification.
In that case, in your original script the error was the dictionary used. You need to use โdssproject.get_permissions()["permissionsโ]โ
The output will have the following format: