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

Run a scenario within a scenario

yazidsaissi
Level 1
Run a scenario within a scenario

Hi,

I have a scenario that run my flow for a single day and I want to create another scenario that run it for multiple days using a python script.

For example:

Scenario 1 run for day 1

I want to create another scenario like:

while i >= start_date and i <= end_date:

   Run Scenario 1 for day i

Does anyone has an idea about how to do it ?

Thanks

0 Kudos
2 Replies
Turribeach

Running a scenario it's easy:

client = dataiku.api_client()
client.get_project("project_key")
scenario = project.get_scenario("scenario_id")
scenario.run_and_wait()

 In terms of your date it depends on how you are going to pass it, so you will need to give us more information to understand how it is being handled. 

yazidsaissi
Level 1
Author

Thanks for the answer.

For the date, it's global variable.

At the beginning of my flow, I have a SQL recipe, where I'm filtering my table using the date varibale (the query is like select * from table where date = '${date}') and at the end of my flow, I append the results in a dataset. 

Now instead a having just one date variable, I will have a start and end date variables, and I want to run the precious scenario for each day between the 2 dates and then append the results to the final table.

I hope i was clear.

Thanks

0 Kudos