Matt Burgess created NIFI-5419:
----------------------------------
Summary: Improve alias handling in DB Fetch processors
Key: NIFI-5419
URL: https://issues.apache.org/jira/browse/NIFI-5419
Project: Apache NiFi
Issue Type: Improvement
Components: Extensions
Reporter: Matt Burgess
Often the DB Fetch processors (GenerateTableFetch, QueryDatabaseTable, etc.)
ask the configured Database Type (aka DB adapter) for DB-specific things such
as generated SQL for SELECT, INSERT, etc. However GenerateTableFetch (as an
example), when it fetches the COUNT and MAX for a specified Maximum Value
Column, hard-codes the alias as the following:
{{SELECT COUNT(*), MAX(myColumn) myColumn}}
This works for many databases in many situations, but still can result in
errors. For example, in PostgreSQL if the column name is a reserved word, then
the above format will not work; the alias needs an explicit AS, and perhaps
even quoting.
This may be as simple as hard-coding the AS keyword into the query, but we'd
need to test this on all databases we wish the processor to work with. If it is
a DB-specific issue, then we'd need to move the logic into the DB Adapters and
have the fetch processors call to the adapter to get the correct clause.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)