We can store state to DistributeMapCache/HDFS/Hive/Hbase and pullled the stored state and use it in ExecuteSQL processor to incrementally pull the data.
Try with this approach mentioned in this link.
-
In QueryDatabaseTable processor we need to configure max value columns so that nifi stores the state in to QueryDatabaseTable processor.
In next run QueryDatabaseTable pulls only the latest changes from the table.