Community Conundrum 25: Feature Visualization is now live! Read More

How to add a group to a DSS Project using a Python Script

How to add a group to a DSS Project using a Python Script

You can add a group to a DSS Project, and add the ldap authorization group, in Python.

Using a Python Script

Here is a sample code snippet to achieve this:

 

 

 



import dataiku
client = dataiku.api_client()

client.create_project(name="SAMPLE_PROJECT", project_key="SAMPLE_PROJECT", owner="YOUR_USER")
project = client.get_project("SAMPLE_PROJECT")

project_permissions = project.get_permissions()
project_permissions['permissions'].append({'group':'data_scientists','readProjectContent': True, 'readDashboards': True})
project.set_permissions(project_permissions)


 

 

 

Please note for this snippet, there are two assumptions:

  1. There is a user called YOUR_USER so replace that with a user that actually exists on your instance.
  2. There is a group called data_scientists.

In an Automation Node

After activating the project in an Automation node, you can edit permissions and give access to the relevant groups.

Specifying which datasets should be included in a Project Bundle

The bundle you create will do so using the project settings. Therefore, before you create it, modify the settings of the project. Depending on whether you use the Python or HTTP rest API, the section to modify is:

 

 

 

project_settings['bundleExporterSettings']['exportOptions']

 

 

 

In order to get there, instantiate the project and modify the settings (obtain settings, then edit the relevant part), see this section of the reference documentation for an example.

Regarding the exact shape of what you need to enter, you may find it easier to create through the UI, and then inspect the resulting settings of the project in the API. That way, you can modify it programmatically later.

Next Steps

For further information about utilizing the Python APIs, please refer to the following documents:

  1. User and groups
  2. Modifying project settings
Labels (2)
Version history
Revision #:
10 of 11
Last update:
‎08-12-2020 06:50 PM
Updated by:
 
Contributors