Solved

I am trying to do an update to a PostGres database based on whether or not the created key column is present or not.


Badge
  • Contributor
  • 8 replies

I am trying to do an update to a PostGres database based on whether or not the created key PID is present or not. If the created key PID is present for the row it updates the row with the new information if not it inserts it as new row. The problem is the test for the difference created a different stream and it won't let me have two writers writing to the same table. The table name gets a 00 appended to it and can not be changed to be the same as the other stream. This seems like I am missing something simple as database operations go but why will FME not let me set two different writers to the same database table to satisfy the two possible condiditions?PostGres Update

icon

Best answer by markatsafe 14 June 2021, 23:48

View original

6 replies

Badge

Sorry. I copied the writer instead of creating a new one!

Badge +2

@mdk​ I would recommend against using two separate writers, and instead experiment with the Feature Operation: fme_db_operation. Set fme_db_operation to INSERT, UPDATE or DELETE as appropriate.

Badge

Mark

Thanks but if I am replacing the row as identified by a generated primary key (see attached) fme_db_operation does not seem to work.PostGres Update2

Badge

@mdk​ I would recommend against using two separate writers, and instead experiment with the Feature Operation: fme_db_operation. Set fme_db_operation to INSERT, UPDATE or DELETE as appropriate.

Mark:

Please see my follow up question in this thread. Thanks for your help!

Badge +2

@mdk - I couldn't reproduce that in FME 2021. pkey worked OK with fme_db_operation. If you want to pursue this further then perhaps try and reproduce it in the attached workspace (2021.0).

Otherwise using two writers is a good workaround

Badge

@mdk - I couldn't reproduce that in FME 2021. pkey worked OK with fme_db_operation. If you want to pursue this further then perhaps try and reproduce it in the attached workspace (2021.0).

Otherwise using two writers is a good workaround

Ah, gotcha! Thanks!

Reply