Code Sample | Add a group to a Dataiku project using Python#

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

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:

  • There is a user called YOUR_USER so replace that with a user that actually exists on your instance.

  • 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 Developer Guide 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.

Note

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