[
https://issues.apache.org/jira/browse/NIFI-4393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16336178#comment-16336178
]
ASF GitHub Bot commented on NIFI-4393:
--------------------------------------
Github user mattyb149 commented on the issue:
https://github.com/apache/nifi/pull/2424
Another approach, rather than "unwrapping" column names that are specified
with dialect-specific characters in the properties, is to have them specified
without the characters in the property, and the generated SQL would "wrap" them
with the characters. This is the way I've seen it done before, by adding
"getStartQuote" and "getEndQuote" methods to the DatabaseAdapter (possibly one
set for table/DB names and one for column names in case they are specified
differently in the dialect, I think at least one DB has different quotes for
tables vs columns but I can't think of which one offhand). With the "wrap"
approach, there are two downsides:
1) Users will have to change their properties to remove the special
characters. However if this bug is saying that the special-character approach
already doesn't work, then perhaps this is a non-issue.
2) We won't support column names that have commas in them. Again, we don't
currently support this unless it happens to work with the special characters.
The upside is that the property values would be more "natural", just a
comma-separated list of column names (possibly with spaces or other values in
them), and we don't have to rely on a regex to "unwrap" them, rather we would
only "wrap" them internally when needed for the generated SQL.
> AbstractDatabaseFetchProcessor handles SQL Server brackets incorrectly
> ----------------------------------------------------------------------
>
> Key: NIFI-4393
> URL: https://issues.apache.org/jira/browse/NIFI-4393
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.4.0
> Reporter: MikoĊaj Siedlarek
> Assignee: Koji Kawamura
> Priority: Major
> Attachments:
> 0001-Handle-SQL-Server-square-brackets-in-AbstractDatabas.patch
>
>
> SQL Server allows column names to contain whitespace, in which case they are
> written in SQL queries inside square brackets. When using processors based on
> {{AbstractDatabaseFetchProcessor}}, such as {{QueryDatabaseTable}} they have
> to be specified in "Maximum-value Columns" in square brackets, because
> otherwise they would break a SELECT query. However, when such column name is
> retrieved from ResultSetMetaData, the driver returns it without square
> brackets. This causes a mismatch between the key used to save last seen
> maximum value in processor's state and the one used to search for the value
> later.
> I'm not sure whether the attached patch is very elegant, but it fixes the
> issue in a simplest way possible.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)