Macro run with api
Hello,
I am using Dataiku 9.0 version.
I develop a plugin to run a macro. This macro gets a folder from a managed_folder param that we indicate manually when we launch (with 'MANAGED_FOLDER' param in the Runnable.json).
I am trying to launch it from the pythonapi, and do not know how to fill the param dict in DSSMacro.run(params={}) to precise the managed folder needed for the param.
Does anyone had this issue for params in macro.run ?
Thanks for your help.
Operating system used: linux
Best Answer
-
Hi @benbeckerfr
,The "params" kwarg is a dict of parameters that will be passed to the macro. For MANAGED_FOLDER parameters, the value should be set to the ID of the managed folder.
Here's an example:
run_id = my_macro.run( params={"my_folder": "9UQMRQ9O"} )
Thanks,
Zach
Answers
-
an you please guide how to pass value to select parameters of macro to run macro using python api
Lable of parameter is Project Key
Name is prj_key
-
Hi @Raj7974
,To pass a SELECT parameter, you would set the parameter to the value of the choice.
For example, with the following SELECT parameter:
{ "name": "prj_key", "label": "Project Key", "type": "SELECT", "selectChoices": [ { "value": "foo", "label": "Label for foo" }, { "value": "bar", "label": "Label for bar" } ] }
You would run it by setting the value to "foo" or "bar":
run_id = my_macro.run( params={"prj_key": "foo"} )
-
Can you please share steps to create plugin so that it will be visible in action of flows.
I know how to create macros but I want it in Action just like we have options of duplicate, export and delete
-
You can configure a macro to appear in the action menu by adding a macro role. Documentation is available here: https://doc.dataiku.com/dss/latest/plugins/reference/macros.html#macro-roles
For example, the Excel sheet importer plugin adds a macro with the MANAGED_FOLDER role, which is visible under "Other actions" as shown below: