Skip to main content
Question

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


phauptmann

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

chrisatsafe
Contributor
Forum|alt.badge.img+2
  • Contributor
  • March 17, 2021

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.


michael_m
Participant
Forum|alt.badge.img+1
  • Participant
  • May 15, 2023
chrisatsafe wrote:

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.


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • May 16, 2023
michael_m wrote:

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).


michael_m
Participant
Forum|alt.badge.img+1
  • Participant
  • May 16, 2023
michael_m wrote:

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


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