Is there a Denodo 8 VQL function or line of VQL for throwing an error in a VDP scheduler job?

375 Views Asked by At

My goal is to load a cache when there is new data available. Data is loaded into the source table once a day but at an unpredictable time.

I've been trying to set up a data availability trigger VDP scheduler job like described in this Denodo community post:

https://community.denodo.com/answers/question/details?questionId=9060g0000004FOtAAM&title=Run+Scheduler+Job+Based+on+Value+from+a+Query

The post describes creating a scheduler job to fail whenever the condition is not satisfied. Now the only way I've found to force an error on certain conditions is to just use (1/0) and this doesn't always work for some reason. I was wondering if there is way to do this with a function like in normal SQL, couldn't find anything in the Denodo documentation.

This is what my code currently looks like:

--Trigger job SELECT CASE WHEN ( data_in_cache = current_data ) THEN 1 % 0 ELSE 1 END FROM database.table;

The cache job waits for the trigger job to be successful so the cache will only load when the data in the cache is outdated. This doesn't always work even though I feel it should.

Hoping someone has a function or line of VQL to make Denodo scheduler VDP job result in an error.

1

There are 1 best solutions below

0
On

This would be easy by creating a custom function that, when executed, just throws an Exception. It doesn't need to be an Exception, you could create your own Exception to see it in the error trace. In any case, it could be something like this...

@CustomElement(type = CustomElementType.VDPFUNCTION, name = "ERROR_SAMPLE_FUNCTION")
public class ErrorSampleVdpFunction {

    @CustomExecutor
    public CustomArrayValue errorSampleFunction() throws Exception {
        throw new Exception("This is an error");
    }
}

So you will use it like:

--Trigger job SELECT CASE WHEN ( data_in_cache = current_data ) THEN errorSampleFunction() ELSE 1 END FROM database.table;