Can a project variable be used as a scenario variable?

Registered Posts: 198 ✭✭✭✭✭✭

Hi,

I have a SQL query that when it returns no data, I need to be able to change the email content of my scenario reporter.
I am currently setting a project variable and have a couple questions:

1. Can I use the project variable to conditional change which email reporter to use?

2. If no to #1, what is the best way forward? When this variable is True I need to change the email header vs the default

thx

Operating system used: WIndows11

Best Answer

  • Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,387 Neuron
    Answer ✓

    Project variables can work for this but they are not the best solution since they are persisted in the project so in effect they change the project every time. It's best to use scenario variables. The documentation is not very good on using SQL results to create a variable. However I wrote this post today showing how to use a metric to conditionally execute scenario steps. You can use a similar approach with your mail reporter which will be able to access any scenario variables you define. I am not a big fan of using Execute SQL steps since they hardcode the table name. I would use a regular dataset. And here is one post I wrote earlier showing how to use a count of records metric of a dataset to control an email.

Answers

  • Registered Posts: 198 ✭✭✭✭✭✭

    I am going to try all of your suggestions. In this particular case we may get by with setting the variable because it is a one-off dataiku project executed in our automation node. But I get your point that this would not work if users were to rerun the project scenario and expecting a new result.

  • Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,387 Neuron

    The added benefit of scenario variables over project variables is that they are defined in the scenario so any users trying to figure out where the variable comes from will be able to see the definition in the scenario rathen than knowing about project variables.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.