Shared datasets in Flow Zone

Options
PoojaJogdand
PoojaJogdand Registered Posts: 1 ✭✭✭

How to find shared dataset list from number of flow zone? the dataset present in default zone but used in other created zone.

Answers

  • Keiji
    Keiji Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 52 Dataiker
    edited July 17
    Options

    Hello @PoojaJogdand
    ,

    With the Dataiku Python API, you can use the DSSFlowZone.shared property to get a list of items which are shared to a zone.

    Here is sample code to list datasets which are shared to a zone:

    from collections import defaultdict
    import dataiku
    from dataikuapi.dss.dataset import DSSDataset
    
    
    client = dataiku.api_client()
    project = client.get_project(dataiku.default_project_key())
    flow = project.get_flow()
    
    shared_datasets = defaultdict(set)
    
    for zone in flow.list_zones():
        for item in zone.shared:
            if type(item) is DSSDataset:
                shared_datasets[item.id].add(zone.name)
            
    for shared_dataset in shared_datasets.items():
        print(shared_dataset)

    Screen Shot 2021-10-29 at 12.08.56.pngScreen Shot 2021-10-29 at 12.09.10.png

    I hope this would help.

    Sincerely,
    Keiji

Setup Info
    Tags
      Help me…