Ok. We're still earlyish in our development that we can use that ConvertJSON hack. Ping me on the PR when you're ready because that would be a good win for 1.9.
Thanks, Mike On Thu, Jan 31, 2019 at 2:54 PM Matt Burgess <[email protected]> wrote: > Mike, > > That's not currently possible with PutDatabaseRecord per se, I've been > meaning to add the upsert capability but haven't gotten around to it. > Some folks have tried setting the statement.type attribute to "insert" > at first, then if the flow file is routed to failure/retry the > attribute is updated to be "update". Keep in mind though that PDR > performs the operation on the entire flow file so that the transaction > can be rolled back at the DB on error. This means if some of the > records in the flow file exist in the DB and others don't, both > "insert" and "update will fail. This was a design decision meant to > support batch operations as a single transaction, rather than an > attempt to run the operation on each record and send the failed > records to failure and the successful records to success. For that > pattern, you can split the records into single-record flowfiles, > convert the record to JSON, then ConvertJsonToSQL -> PutSQL. In fact, > for Phoenix specifically I have heard of folks putting a ReplaceText > in between, changing INSERT to UPSERT before sending to PutSQL. The > irony is that once each flow file has had its SQL updated to UPSERT, > they could have been executed as a single transaction instead of > having to go through individually. That's why the UPSERT capability > for PDR would be so handy, and now that you've reminded me, I should > probably get back to it :) > > Regards, > Matt > > On Thu, Jan 31, 2019 at 2:40 PM Mike Thomsen <[email protected]> > wrote: > > > > The syntax for Phoenix that I see all over the place is an upsert. How > do I specify that with PutDatabaseRecord? > > > > Thanks, > > > > Mike >
