Check out the first Dataiku 8 Deep Dive focusing on Productivity today, October 29th, at 11:00 AM ET Read More

Python API - Dataset Shares

Level 2
Level 2
Python API - Dataset Shares

I'm wondering how to find all of the projects that are "receiving" shared datasets from a project (very similar to the graph project view) using Python. 

For example, if I'm sharing Dataset A from Project 1 to Project 2 and Project 3, I'd like to be able to do something like:

project = client.get_project('project1')
shares = project.get_dependent_projects() # return a list showing that Dataset A is shared with P2 and P3

Is there a way to do this?


0 Kudos
1 Reply

Hi @rmoore. What I've been using is this code:

shared = {}
project = client.get_project('project1')
exposed = project.get_settings().settings['exposedObjects']['objects']
for e in exposed:
if e['type'] == "DATASET":
name = e['localName']
rules = e['rules']
shared[name] = []
for r in rules:
proj = r['targetProject']
print(f'Dataset {name} is exposed in Project {proj}')

This get you a dictionary, with one 'key' by shared dataset, and the values of the dictionary are the lists with the name of the projects that have access to a particular dataset.

I choose a dictionary, because I've some projects with multiple datasets being shared. For example, one output for me is:

{'datas_array_ebs': ['NEWDSAALGORITHM'],
 'fieldsource': ['SPECIFICPARSING'],
 'datas_projects': ['LASANALYSIS'],
 'datas_sb_status': ['CONESEARCHES', 'DUPLICATION_CHECKS'],
 'datas_schedblocks': ['CONESEARCHES', 'C7ACTIVESBSQA0QUERIES'],
 'datas_aqua_execblock': ['C7ACTIVESBSQA0QUERIES'],
 'datas_target_tables': ['CONESEARCHES']}


Labels (1)