You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Mike Thomsen (JIRA)" <ji...@apache.org> on 2018/07/14 01:48:00 UTC
[jira] [Commented] (NIFI-5081) Lack of guidance and inability to
deal with ISO-8601 dates
[ https://issues.apache.org/jira/browse/NIFI-5081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16543934#comment-16543934 ]
Mike Thomsen commented on NIFI-5081:
------------------------------------
[~forbesmyester] you should be able to use PutMongoRecord for this. What you do is you fill out the "timestamp" property of the record reader (ex JsonTreeReader) to use the proper date parsing syntax for reading an ISO8601 string. There's an example somewhere on the Record API document that you can lift for some flavors of ISO8601. Then in the Avro schema you declare the field to be a long with a logicalType ([Avro documentation|https://avro.apache.org/docs/1.8.0/spec.html#Timestamp+%28millisecond+precision%29])
> Lack of guidance and inability to deal with ISO-8601 dates
> ----------------------------------------------------------
>
> Key: NIFI-5081
> URL: https://issues.apache.org/jira/browse/NIFI-5081
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Documentation & Website
> Affects Versions: 1.6.0
> Environment: Ubuntu / Chromeium
> Reporter: Matt Forrester
> Priority: Minor
> Attachments: y.xml
>
>
> I've got a Node process that outputs in JSON onto an SQS queue. The dates it spits out are ISO-8601 dates within a string, which is the normal, default and best way to do this in JSON.
> I tried putting them into MongoDB with PutMongo and they go in as strings, which is not good ( https://issues.apache.org/jira/browse/NIFI-2079 ).
> Gave up on Mongo and tried PostgreSQL...
> Figuring I was in Java land I used an esoteric path of GetSQS > EvaluateJsonPath > UpdateAttribute [ "$\{time:toDate("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "GMT") ] > PutSQL to get it into what I assume is a java.lang.Date, it took me forever to find the sql.args.N.type's required but for some reason PutSQL does not like java.util.Dates.
> Eventually found the ConvertJSONToSQL processor and this created my SQL for me, but it doesn't work as it leaves ISO-8601 dates as ISO-8601 dates, which don't seem to work.
> Eventually found this [https://community.hortonworks.com/questions/84772/putsql-with-date-as-argument.html] and now I have something working, but I'm using my esoteric GetSQS -> EvaluateJsonPath -> UpdateAttribute -> PutSQL path again.
> Think there should be some documentation around this at least because it's very non-obvious.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)