Skip to main content
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.


mdk
Contributor
Forum|alt.badge.img+1
  • Contributor

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

Best answer by markatsafe

@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

View original
Did this help you find an answer to your question?

6 replies

mdk
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • June 14, 2021

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


Forum|alt.badge.img+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.


mdk
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • June 14, 2021

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


mdk
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • June 14, 2021
markatsafe wrote:

@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!


Forum|alt.badge.img+2
  • Best Answer
  • June 14, 2021

@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


mdk
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • June 15, 2021
markatsafe wrote:

@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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings