Survey banner
The Dataiku Community is moving to a new home! Some short term disruption starting next week: LEARN MORE

Create a custom plugin with python code but not using a dataset

Veeru
Level 1
Create a custom plugin with python code but not using a dataset

Hi All,

 

I would like to create a plugin by using either notebook (.ipynb) file or python (.py) file without using any dataset like csv r any database etc.

 

Is it possible to create it, if so, may i have the project flow and it would be a great encouragement.

 

Regards

Veera  

2 Replies
Grixis
Level 4

Hey @Veeru 

Yes that’s it. the concept of the plugin is to allow custom development of your visual components and you can also define your inputs. Your question is short but I suppose that you are talking about a visual recipe in your flow which for its operation would not require any 'input' therefore no dataset like csv or any database. You habe to manage this in the runnable files of your plugin, in particular the runnable.json params.

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 https://academy.dataiku.com/plugin-development

have fun 🙂

 

0 Kudos
Turribeach

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()

 

 

 

 

0 Kudos