Survey banner
The Dataiku Community is moving to a new home! We are temporary in read only mode: LEARN MORE

Is it possible to create a custom new plugin with just python code but not using any dataset ?

Level 1
Is it possible to create a custom new plugin with just python code but not using any dataset ?

Hi All,


I need to create a project to with recipe plugin using ipynb notebook or .py file only but without using any data (dataset, csv, anything etc...)

Is it possible to create it in Dataiku. If so may i have any support for the project flow and details, please.




0 Kudos
2 Replies
Level 4

Hey Veeru,

I replied to you on your second post about this subject. 🙂

Yes you can handle it by developping your own plugin and create a custom recipe as a visual componant of it.

So, for start you just have to go to the summary tab of your instance right corner > application > plugin > add plugin > write your own instance.

And I suggest you start with this one because I couldn't cover all the other steps in a comment


0 Kudos

I think there are few misguided things in your post so I am going to address them all:

  1. Please do not do multiple posts at the same time, it makes those willing to help answering your question waste time as you  are duplicating messages.
  2. Please post any sample code using the code block (the </> icon on the tool bar) and set it to the right languange so it can be disaplyed in-message rather than as an attachment (see sample below).
  3. When using recipes/notebook sin Dataiku you don't need to use references to __main__ like in Python modules. You can just write the code from top to bottom. If you want to use functions just make sure they are defined at the top or before they are used in in your code.
  4. You should not be writting directly to the OS file system from dataiku, you should a Dataiku Managed folder and the corresponding Python APIs.
  5. Python recipes don't need to have a dataset input so when you create them you can just set the output and they can query an external API and push the data to the output dataset. Furthermore they also don't need to write to a dataset, they can write to a folder as output. See sample mini  flow:Screenshot 2024-05-23 at 00.36.26.png
  6. It's not really clear why you are trying to save project info as JSON files, this looks like a kludge to me. What exactly are you trying to achieve with this? What is the actual requirement? Regardless of whatever you want to do you should be using the Python API not the REST API which is much more primitive in its responses. The following Python code will return all projects and their main  properties in Python dictionary which is very easy to convert to JSON:
import dataiku
client = dataiku.api_client()

# Get a list of Projects
projects = client.list_projects()


def save_project_info(url, username, save_path):
    # Make GET request with basic authentication
    response = requests.get(url, auth=(username, ''))

    # Check if request was successful
    if response.status_code == 200:
        # Parse JSON response
        project_info = response.json()

        # Save project information to a new .txt file
        with open(save_path, 'w') as file:
            file.write(json.dumps(project_info, indent=4))
        print("Project information saved successfully to:", save_path)
        project_info_fail = response.json()

        # Save project information to a new .txt file
        with open(save_path, 'w') as file:
            file.write(json.dumps(project_info_fail, indent=4))
        print("Failed to retrieve project information. Status code:", response.status_code)

if __name__ == "__main__":
    project_id = input("Enter the ProjectID/Name: ")
    url_path = "http://localhost:11200/public/api/projects/"
    final_url = url_path + project_id
    username = input("Enter the Username: ")
    save_path = input("Enter the local path to save the file: ")
    final_save_path = save_path + project_id + ".json"
    save_project_info(final_url, username, final_save_path)


0 Kudos