We're excited to announce that we're launching the second installment of Dataiku Product Days Register Now

get datasets list in a flowzone using api

Solved!
pritam003
Level 1
get datasets list in a flowzone using api

Hi Team

 

Is there way to get the datasets name in a flow zone using API

for item in zone.items:
print(item)

this prints the zone items but not there name 

 

Thanks 

pritam

0 Kudos
1 Solution
AlexT
Dataiker
Dataiker

Hi,

That's because the datasets are returned as objects. If you use something like print("Zone item: %s" % item.__dict__) it will also print the dataset_name:

import dataiku
import dataikuapi
import pandas as pd, numpy as np

client = dataiku.api_client()
project_key = 'REPLACE_PROJECT_KEY'
project = client.get_project(project_key)

# List zones

flow = project.get_flow()


for zone in flow.list_zones():
    print("Zone id=%s name=%s" % (zone.id, zone.name))

    print("Zone has the following items:")
    for item in zone.items:
        print("Zone item: %s" % item.__dict__)

 

Screenshot 2021-10-26 at 11.52.51.png

 

Let me know if that works for you.

View solution in original post

1 Reply
AlexT
Dataiker
Dataiker

Hi,

That's because the datasets are returned as objects. If you use something like print("Zone item: %s" % item.__dict__) it will also print the dataset_name:

import dataiku
import dataikuapi
import pandas as pd, numpy as np

client = dataiku.api_client()
project_key = 'REPLACE_PROJECT_KEY'
project = client.get_project(project_key)

# List zones

flow = project.get_flow()


for zone in flow.list_zones():
    print("Zone id=%s name=%s" % (zone.id, zone.name))

    print("Zone has the following items:")
    for item in zone.items:
        print("Zone item: %s" % item.__dict__)

 

Screenshot 2021-10-26 at 11.52.51.png

 

Let me know if that works for you.

View solution in original post

A banner prompting to get Dataiku DSS