Question

I need help to completely remove all records from a SDE feature class and then append it with new data.

  • 17 March 2021
  • 4 replies
  • 33 views

So, the workflow is as follows.

I managed to download a folder from a URL-adress and to unzip it. Next step is where I got stuck. I want to remove all record in my feature class (ArcSDE-database) and then I want to append the same feature class with the records from the shapefile that I downloaded. Anyone got any tips on which transformers to use?

Super thankful for your help.


4 replies

Badge +2

As long as the shapefile and SDE have the same schema, you can simply connect the two streams to the same writer to append the data (if order is important you can connect both to a Sorter before the writer). Since you want to remove all existing records, you can use the Truncate Existing table handling in the writer parameters

2021-03-17_10-16-27Worth noting, since you want to append the shapefile to an existing table, you could also just inset the shapefile data into the existing table instead of truncating (unless you are updating the existing features at the same time). Take a look at the Combining Multiple Streams of Data (Append vs. Merge or Join) article as it helps to highlight this transformation.

 

In terms of managing the schema, you could do this with a number of transformers, like the SchemaMapper for example, but my go to is the AttributeManager.

Badge

As long as the shapefile and SDE have the same schema, you can simply connect the two streams to the same writer to append the data (if order is important you can connect both to a Sorter before the writer). Since you want to remove all existing records, you can use the Truncate Existing table handling in the writer parameters

2021-03-17_10-16-27Worth noting, since you want to append the shapefile to an existing table, you could also just inset the shapefile data into the existing table instead of truncating (unless you are updating the existing features at the same time). Take a look at the Combining Multiple Streams of Data (Append vs. Merge or Join) article as it helps to highlight this transformation.

 

In terms of managing the schema, you could do this with a number of transformers, like the SchemaMapper for example, but my go to is the AttributeManager.

This technique works great as long as there is something to write. I am working on a process that reads input, creates some spatial data and writes to an SDE feature class. The problem I'm having is if there is nothing in the input file (which is a valid occurrence) then the feature class isn't touched and is left with whatever data it had in it already; what I need to have happen is to have the feature class end up with nothing in it when the input file is empty. How can this be done?

 

Thanks for your help.

Userlevel 4
Badge +36

This technique works great as long as there is something to write. I am working on a process that reads input, creates some spatial data and writes to an SDE feature class. The problem I'm having is if there is nothing in the input file (which is a valid occurrence) then the feature class isn't touched and is left with whatever data it had in it already; what I need to have happen is to have the feature class end up with nothing in it when the input file is empty. How can this be done?

 

Thanks for your help.

You can truncate the SDE feature class with SQLExecutor.

Or you can try NoFeaturesTester (FME Hub).

Badge

This technique works great as long as there is something to write. I am working on a process that reads input, creates some spatial data and writes to an SDE feature class. The problem I'm having is if there is nothing in the input file (which is a valid occurrence) then the feature class isn't touched and is left with whatever data it had in it already; what I need to have happen is to have the feature class end up with nothing in it when the input file is empty. How can this be done?

 

Thanks for your help.

I cannot get SQLExecutor to use my SDE's connection file. Is there a trick to doing it?

Reply