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.

  • June 14, 2021
  • 6 replies
  • 57 views

mdk
Contributor
Forum|alt.badge.img+1
  • 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

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

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

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


Forum|alt.badge.img+2
  • 1891 replies
  • June 14, 2021

@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
  • 8 replies
  • 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
  • 8 replies
  • June 14, 2021

@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
  • 1891 replies
  • 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
  • 8 replies
  • June 15, 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

Ah, gotcha! Thanks!