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

Dataiku Administrator, Dataiker, Alpha Tester Posts: 88 Administrator
edited July 16 in Knowledge Base

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})

Please note for this snippet, there are two assumptions:

  1. There is a user called <span>YOUR_USER</span> 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:


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
Setup Info
      Help me…