[ 
https://issues.apache.org/jira/browse/NIFI-5901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17222159#comment-17222159
 ] 

Christoph Charlet commented on NIFI-5901:
-----------------------------------------

Turns out I stumbled across another issue with the current merge request: both 
nested JSONs and arrays don't work as expected for me. Instead of writing out 
the nested objects into the JSON, the database record contains the _schema_ for 
nested objects, not the objects themselves.

As near as I can tell this is caused by the Jackson BeanPropertyWriter using 
the getSchema method as method accessor, though I have no idea why that 
happens. The obvious approach (which I have patched in for my purposes) is to 
just recursively recast Records to Maps, but I think it might be more efficient 
to register a custom serialiser?

Happy to provide both test cases and a patch if anybody's interested.

> Write JSON record in database
> -----------------------------
>
>                 Key: NIFI-5901
>                 URL: https://issues.apache.org/jira/browse/NIFI-5901
>             Project: Apache NiFi
>          Issue Type: Improvement
>    Affects Versions: 1.8.0
>            Reporter: Flo Rance
>            Assignee: Mike Thomsen
>            Priority: Minor
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> It would be good to be able to store a whole json record in databases that 
> implement it (e.g. postgresql). This would require to define the field in the 
> shema as json/jsonb and then let PutDatabaseRecord inserts the json value in 
> the json/jsonb field.
> At the moment, it's possible to store a json/jsonb through Postgresql JDBC 
> using the Java sql type 'OTHER':
> Object data = "\{...}"; // the JSON document
> PreparedStatement.setObject(1, data, java.sql.Types.OTHER);



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to