Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2162#discussion_r163442381
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractDatabaseFetchProcessor.java
 ---
    @@ -156,10 +157,22 @@
                 .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
                 .build();
     
    +    public static final PropertyDescriptor SQL_QUERY = new 
PropertyDescriptor.Builder()
    +            .name("db-fetch-sql-query")
    +            .displayName("Custom Query")
    +            .description("A custom SQL query used to retrieve data. 
Instead of building a SQL query from "
    +                    + "other properties, this query will be used. Query 
must have no WHERE or ORDER BY statements. "
    +                    + "If a WHERE clause is needed use a sub-query or the 
'Additional WHERE clause' property.")
    --- End diff --
    
    Can we generate a sub-query from this property by simply wrapping it with 
braces and add the specified `Table name` as the alias name of it? If we do so, 
we can use Expression Language and incoming FlowFiles more creatively with the 
single QueryDatabaseTable processor instance. Also it will allow user to define 
WHERE and ORDER BY statement here.
    
    With that approach, we can keep using the `Table Name` property as it is, 
and the custom validation is not required. This `Custom Query` property can be 
truly an optional property.
    
    Current proposed approach use a constant "NiFi_QDBT" table name for state 
keys, and it can limit the use-case. How do you think?


---

Reply via email to