Situation:
Need to add a Tool to my ModelBuider to Delete only the content from an Enterprise (SDE) Geodatabase (containing features classes, tables, relationship classes).
Tool "Delete" (from Toolbox "Data Management") deletes the Geodatabase and only want to delete its content.
Any help?
Solved! Go to Solution.
The easiest option would be to build a script tool to use the arcpy.da.walk method to walk through your geodatabase and delete each item found.
arcpy.da.walk
http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-data-access/walk.htm
If you wanted to accomplish this in ModelBuilder you could build a series of submodels with the different iterators that could delete different types of data.
A quick tour of using iterators
The catch with using the iterators within ModelBuilder with be that 1) not all types are available within the given set of iterators and 2) without using a script tool for the deletion logic it'd be hard to catch errors that would stop the model (i.e. deleting features that you don't have permissions to, items that can't be deleted because they participate in a relationship, etc.)
The easiest option would be to build a script tool to use the arcpy.da.walk method to walk through your geodatabase and delete each item found.
arcpy.da.walk
http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-data-access/walk.htm
If you wanted to accomplish this in ModelBuilder you could build a series of submodels with the different iterators that could delete different types of data.
A quick tour of using iterators
The catch with using the iterators within ModelBuilder with be that 1) not all types are available within the given set of iterators and 2) without using a script tool for the deletion logic it'd be hard to catch errors that would stop the model (i.e. deleting features that you don't have permissions to, items that can't be deleted because they participate in a relationship, etc.)