How to get a list of the datasets in a notebook

davidmakovoz
davidmakovoz Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2022, Neuron 2023 Posts: 67 Neuron
In a jupyter notebook I can use the Dataset class from the dataiku package to read a dataset if I know it's name.

However, I can't find a way to list all the datasets programmatically, in a notebook. Is there one?

Best Answer

  • Mattsco
    Mattsco Dataiker, Registered Posts: 125 Dataiker
    Answer ✓

    Hi David,



    Yes, you can do :


    import dataiku
    client = dataiku.api_client()
    project = client.get_project('TEST_PROJECT')
    datasets = project.list_datasets()

Answers

  • davidmakovoz
    davidmakovoz Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2022, Neuron 2023 Posts: 67 Neuron
    A follow-up question. I'm getting
    DataikuException: com.dataiku.dip.exceptions.UnauthorizedException: Failed to read project permissions
    error running project.list_datasets()
    I am an admin. Do you know how I fix this problem? thanks
  • Mattsco
    Mattsco Dataiker, Registered Posts: 125 Dataiker
    Hi, did you use the right projectKey?
    ProjectKey is always in capital letter and can be found in the URL
  • davidmakovoz
    davidmakovoz Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2022, Neuron 2023 Posts: 67 Neuron
    Thank you, I didn't realize the name should be all capital. Problem solved!
Setup Info
    Tags
      Help me…