Skip to main content
Solved

How to write data to a SQL database if a table exists in GDB and if doesn't truncate that table in the SQL database?

  • March 19, 2026
  • 4 replies
  • 54 views

kmc5678
Contributor
Forum|alt.badge.img+4

I’m creating a workspace that reads 7-8 tables from a file geodatabase and then writes them into tables in a SQL database.  One of the tables is sometimes present and sometimes missing (that is expected).  I need to create a workflow where when the table is present we write the data into the SQL table and when it is not present we just truncate that same table in the SQL database.  I currently have a gdb reader connected to a tester that passes when fme_feature_type Like MSAG_To_RCL_Synchronization. This works when the table is there but when it’s missing the reader just closes and gives the message “The table name 'MSAG_To_RCL_Synchronization' could not be found in the Geodatabase as either a feature class or a table” and closes before any input gets to the tester. Any ideas on how to conditionally test if a table exist or not and then either write the data or truncate a SQL table.

 

Best answer by dustin

I think I understand now. There is a custom transformer called NoFeatureTester. It should show up when you search for it. If you use it instead of the Tester, it should output a feature from the NoInput port that you can send to the SQLExecutor. The output port would go to the writer.

4 replies

dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • March 19, 2026

How is the Table Handling parameter set? It should be Create If Needed in your situation.

 


kmc5678
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • March 19, 2026

Yea I have Create If Needed set on the table handling.  But it never gets to the writer because the reader closes.


dustin
Influencer
Forum|alt.badge.img+31
  • Influencer
  • Best Answer
  • March 19, 2026

I think I understand now. There is a custom transformer called NoFeatureTester. It should show up when you search for it. If you use it instead of the Tester, it should output a feature from the NoInput port that you can send to the SQLExecutor. The output port would go to the writer.


kmc5678
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • March 19, 2026

This worked great, Thanks Dustin!  For anyone else reading this post you have to download NoFeatureTester as a custom transformer and install it.