Create SQL (Script) Recipe via Python API with user sql query

dadbuz
Level 3
Create SQL (Script) Recipe via Python API with user sql query

Hi,

What's the proper way of creating sql recipe with query programmatically through public api. I tried the bellow code but it looks like the with_script isn't working as expected - recipe is created with no code inside.

recipe_creator = project.new_recipe("sql_script", name="test")
recipe = recipe_creator.with_input(input_dataset.id).with_output(output_dataset.id).with_script(query).create()

I'm aware you can use pass in the txt to the recipe payload but hoping to be able to use the above approach so all the configurations is done before the creation.

 

Thanks 

0 Kudos
1 Reply
AlexT
Dataiker

Hi @dadbuz ,
Indeed with_script does not work SQl script recipe only python recipe.

You can refer to this post: https://community.dataiku.com/t5/Using-Dataiku/Create-a-SQL-script-using-the-public-API/m-p/2825

Which illustrates how to create SQL script recipe using the API. Let us know if that helps.

Thanks,

0 Kudos