Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-5419

Improve alias handling in DB Fetch processors

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Extensions
    • Labels:
      None

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mattyb149 Matt Burgess
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: