[
https://issues.apache.org/jira/browse/NIFI-5845?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matt Burgess reassigned NIFI-5845:
----------------------------------
Assignee: Matt Burgess
> Support OTHER and SQLXML JDBC types in database processors
> ----------------------------------------------------------
>
> Key: NIFI-5845
> URL: https://issues.apache.org/jira/browse/NIFI-5845
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Extensions
> Reporter: Matt Burgess
> Assignee: Matt Burgess
> Priority: Major
>
> Currently, OTHER and SQLXML JDBC types are not supported by the database
> processors. When the processor(s) try to create a schema, it does not
> recognize these types and will fail. For example, this happens with
> PostgreSQL's JSONB and XML types, respectively.
> The meaning of OTHER is "the SQL type is database-specific and gets mapped to
> a Java object that can be accessed via the methods getObject and setObject."
> Since they are Java Objects, we could represent them as Strings in the schema
> and use the value of toString(). This doesn't allow us to represent the JSON
> fields as a nested record, but we don't have enough information per se, as an
> OTHER value could be anything. Perhaps in a future improvement we could try
> to parse the object as JSON, and continue if successful. However the schema
> currently has to be determined beforehand, so I'm not sure if that would work.
> For SQLXML, we can use the SQLXML interface to get at the String or even an
> InputStream, and since we know it's XML, we could parse it into records the
> same way XMLRecordReader does. However that would/should involve some
> refactor, to get the common utilities/methods into something like a
> nifi-xml-record-utils package. Also for this Jira it would be inconsistent
> with the handling of JSON fields (if reported as type OTHER). This might make
> a good companion Jira to the aforementioned one, to try and change JSON/XML
> fields into nested records.
> I verified these types with PostgreSQL's JSON, JSONB, and XML types, as well
> as MySQL's JSON type. Oracle's XMLTYPE returns a different code (2007), and I
> couldn't find a way to set the connection property to return SQLXML instead.
> Even with that, you have to add two additional JARs to the classpath, and in
> my experiments it didn't seem to work when I added them to the Driver
> Resources property. Apache Derby doesn't have either type so I wasn't able to
> write unit tests to illustrate this.
> This Jira proposes to add support for OTHER and SQLXML JDBC types to the
> database processors, interpreting their values as Strings.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)