How to set up a check that the data set is empty (0 rows) in a scenario
![aw30](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar1.png)
Hi - I can see in a scenario you can set up a step that includes a data check and within the documentation it says that a check can identify when a data set has 0 records. How exactly can I use this because I want to send an email if the data check of 0 records is found.
I set up the step in my scenario of data check, selected the data set I would like checked - now what is the next step for this condition to trigger the reporter?
Thank you for all the help!
Best Answer
-
tim-wright Partner, L2 Designer, Snowflake Advanced, Neuron 2020, Registered, Neuron 2021, Neuron 2022 Posts: 77 Partner
@aw30
so it sounds like you want the email to be sent when the record count = 0. I am assuming you have already set up the metric (Record Count) and check (Record Count >=1) to calculate. I will also assume that you have a trigger set to actually run (initiate) your scenario.Depending on the steps you want executed in your scenario you might have something like:
1. Build Dataset
2. Compute Metrics (on your dataset) - not necessary if you have them set to calculate each time the dataset is built - you would set this on the dataset metrics,
3. Run Checks (on your dataset)
Configure your reporter to run as below (assuming that the check will return a failure if data size is 0 records): see here: https://doc.dataiku.com/dss/latest/scenarios/reporters.html#executing-scenario-reporters for different ways to define the condition when a report is run.
Note: I'm pretty sure this will run if the outcome of the entire Scenario (is a "Failed") - which could also occur if other steps in the scenario (not just the metric check) failed.
If that is a possibility, another way you could achieve the same would be to add step to your scenario called "send message" immediately after your step to calculate the checks. This will allow you to send a report as a scenario step. If this is the chosen path, you will not have access to all of the scenario variables to inject into your report template, but the report will only be sent if that specific step fails. (There may be a way to do this from the Scenario Reporters (not as a step) but I am unaware)
@aw30
, let me know if this helps, or if I somehow misunderstood your request.
Answers
-
Thank you this is very helpful!!