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 Everyone,
I know we can get the selected engine details of a recipe using the API.
but is there a way to change the engine of the recipe as well using the API ?
Any suggestions are welcome ๐
Thanks..
Hi @NN ,
It is possible to change the engine used by a recipe by changing the value of `engineType` in that recipe's settings.
Here's an example (assume the `engineType` is 'DSS' and I want to change it to 'SQL' via the API):
import dataikuapi
host = DSS_HOST
apiKey = DSS_API_KEY
client = dataikuapi.DSSClient(host, apiKey)
proj = client.get_project("COMMUNITY_24974")
recipe = proj.get_recipe("compute_orders_copy_filtered")
settings = recipe.get_settings()
settings.raw_params['engineType']='SQL'
settings.save()
Note: a recipe may be able to use only a subset of engines. To determine which engines are eligible to be used by a recipe check the output of `recipe.get_status().get_engines_details()`. If an engine has `'isSelectable': True` then that engine can be used for that recipe.
Thank you,
Mike
Hi @NN ,
It is possible to change the engine used by a recipe by changing the value of `engineType` in that recipe's settings.
Here's an example (assume the `engineType` is 'DSS' and I want to change it to 'SQL' via the API):
import dataikuapi
host = DSS_HOST
apiKey = DSS_API_KEY
client = dataikuapi.DSSClient(host, apiKey)
proj = client.get_project("COMMUNITY_24974")
recipe = proj.get_recipe("compute_orders_copy_filtered")
settings = recipe.get_settings()
settings.raw_params['engineType']='SQL'
settings.save()
Note: a recipe may be able to use only a subset of engines. To determine which engines are eligible to be used by a recipe check the output of `recipe.get_status().get_engines_details()`. If an engine has `'isSelectable': True` then that engine can be used for that recipe.
Thank you,
Mike
Thanks @MikeG That works..
Hi Dataiku Team,
I am able to change the engine of prepare recipes using the code. But it fails for other recipes like join and group. The error I get is shown below:
--------------------------------------------------------------------------- KeyError Traceback (most recent call last) <ipython-input-99-f75ef26b38e9> in <module> 1 settings = recipe.get_settings() ----> 2 settings.raw_params['engineType'] = 'DSS' 3 settings.save() /opt/dataiku-dss-12.5.1/python/dataikuapi/dss/recipe.py in raw_params(self) 527 :rtype: dict 528 """ --> 529 return self.recipe_settings["params"] 530 531 def _payload_to_str(self): KeyError: 'params'
Can anyone help me resolve this issue?
Hi @mallisundaresan this thread has been marked as solved. Please start a new thread.
Hi,
For join recipes, you should use the below:
settings.get_json_payload()['engineType'] = 'DSS'
settings.save()
Best.