Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi,
How to create a list of datasets matching a keyword using python API? Need to know this as a part of some project.
Regards
Hi @s_dravid,
The following code will list all datasets in the flow where the name of the dataset contains the word "KEYWORD":
import dataiku
import dataikuapi
client = dataiku.api_client()
project = client.get_default_project()
flow = project.get_flow()
graph = flow.get_graph()
for item in graph.get_items_in_traversal_order(as_type="object"):
if not isinstance(item, dataikuapi.dss.dataset.DSSDataset):
# Skip items that aren't a dataset
continue
if "KEYWORD" in item.name:
print("Found dataset with keyword:", item.name)
Thanks,
Zach
Hi @s_dravid,
The following code will list all datasets in the flow where the name of the dataset contains the word "KEYWORD":
import dataiku
import dataikuapi
client = dataiku.api_client()
project = client.get_default_project()
flow = project.get_flow()
graph = flow.get_graph()
for item in graph.get_items_in_traversal_order(as_type="object"):
if not isinstance(item, dataikuapi.dss.dataset.DSSDataset):
# Skip items that aren't a dataset
continue
if "KEYWORD" in item.name:
print("Found dataset with keyword:", item.name)
Thanks,
Zach
Thanks for the help!