Skip to main content
TonyPath
Silver ⭐️
Aug 26, 2023 11:35 AM UTC
Solved

Dynamic Initial Max Value on GenerateTableFetch

In a GenerateTableFetch i have set as Maximum-value Columns the column updated_at. In addition i have define the property "initial.maxvalue.updated_at" with an hard-code initial value. However i do not want to hardcode manual the initial value but instead grab it dynamically, like performing an SQL statement to get the max updated value from the table. How i could feed such information in "initial.maxvalue.updated_at" ?

SAMSAL
SAMSALAnswer
Platinum ⭐️⭐️⭐️
Aug 26, 2023 1:54 PM UTC

Hi @TonyPath ,

 

I noticed that the added dynamic property initial.maxvalue.<max_column_name> accept expression language (EL) so since the GenerateTableFetch can take incoming relationship maybe you can use  ExecuteSQLRecord to fetch the initial max value from sql into json format  then store it in a flow file attribute using EvaluateJsonPath processor which you can reference to set  the initial.maxvalue.<max_column_name> property value as follows:

 

 

SAMSAL_0-1693057850866.png

 

 

ExecuteSQLRecord Config:

SAMSAL_1-1693057896509.png

 

EvaluateJsonPath Config:

SAMSAL_2-1693057933983.png

 

GenerateTableFetch Config:

SAMSAL_3-1693057992347.png

 

If that helps please accept solution.

Thanks

 

3 replies

SAMSAL
SAMSALAnswer
Platinum ⭐️⭐️⭐️
Aug 26, 2023 1:54 PM UTC

Hi @TonyPath ,

 

I noticed that the added dynamic property initial.maxvalue.<max_column_name> accept expression language (EL) so since the GenerateTableFetch can take incoming relationship maybe you can use  ExecuteSQLRecord to fetch the initial max value from sql into json format  then store it in a flow file attribute using EvaluateJsonPath processor which you can reference to set  the initial.maxvalue.<max_column_name> property value as follows:

 

 

SAMSAL_0-1693057850866.png

 

 

ExecuteSQLRecord Config:

SAMSAL_1-1693057896509.png

 

EvaluateJsonPath Config:

SAMSAL_2-1693057933983.png

 

GenerateTableFetch Config:

SAMSAL_3-1693057992347.png

 

If that helps please accept solution.

Thanks

 

Translate
TonyPath
TonyPathAuthor
Silver ⭐️
Aug 27, 2023 3:12 PM UTC

Hi @SAMSAL, I haven't tried it yet but your proposal makes sense, but the execute sql record will run constantly and required manual intervention to stop it so to produce only one flow file. However this is another case

Translate
SAMSAL
Platinum ⭐️⭐️⭐️
Aug 27, 2023 10:19 PM UTC

How often are you looking to run the GenerateFetchTable ? If its going to be a batch process then you can set up the a schedule on the top processor using processor config -> Scheduling tab and setting the Run Schedule value. By default this value is set to 0 secs which means its continuously running.

Translate