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

force rebuild setting in scenario script

Solved!
Timmy
Level 2
force rebuild setting in scenario script

Hi Dataiku support team,

I am writing python script to run the scenario. 

 

from dataiku.scenario import Scenario
from datetime import datetime, timedelta


# The Scenario object is the main handle from which you initiate steps
scenario = Scenario()


# get date
current_date = datetime.today()
chosen_date = current_date - timedelta(1)
formated_chosen_date = chosen_date.strftime('%Y-%m-%d')

scenario.build_dataset("sample_dataset")

 

 

In the code above, i want to set force_rebuild the "sample_dataset" when running scenario. Is there any parameter setting in the function build_dataset to do this.

Thanks

0 Kudos
1 Solution
Timmy
Level 2
Author

OH, i figure out the setting parameters "build_mode" from scenario.build_dataset() api

https://developer.dataiku.com/latest/api-reference/python/scenarios-inside.html#dataiku.scenario.Sce...

 

 

View solution in original post

0 Kudos
5 Replies
Turribeach

The Scenario object is a special object to obtain a handle to a running scenario inside the scenario itself via a scenario step, so unless that's what you are doing (which it doesn't look like) then that's not the correct way to run a scenario.

Here are two variants on how to run a Scenario:

https://developer.dataiku.com/latest/concepts-and-examples/scenarios.html#run-a-scenario

And here it shows how to get a handle to the Dataiku API Client and to the project where you have the scenario you want to run:

https://developer.dataiku.com/latest/concepts-and-examples/projects.html#handling-an-existing-projec...

 

0 Kudos
Timmy
Level 2
Author

yeap, so even in the link show it still not answer my concern. How to set force_rebuild in the script?

0 Kudos
Timmy
Level 2
Author

I mean, when creating scenario either we set steps through GUI like the attached figure. There's a text box to choose to "force rebuild dataset".

Equivalently, there's script option when creating scenario which give me more flexible to creating scenarios. So my question is how to set force rebuild in the script.

 

 

0 Kudos
Timmy
Level 2
Author

OH, i figure out the setting parameters "build_mode" from scenario.build_dataset() api

https://developer.dataiku.com/latest/api-reference/python/scenarios-inside.html#dataiku.scenario.Sce...

 

 

0 Kudos
Turribeach

The way you asked your question is confusing. Setting the force rebuild in a step has nothing to do with running a scenario. Also there is a difference between creating a scenario from scratch and changing an  already existing scenario step. Please note that the force rebuil is a step setting and is persistent, which means that if you change via code it will remain like that for ever. Depending on what you are trying to do this may or may not the way you want things to be. 

0 Kudos