ArcGIS Pro 2.9.12; Oracle 18c 10.7.1 EGDB:
I have cases where I need to clear the item metadata (FC geoprocessing history) of a feature class in the geodatabase.
For example, in 2.9.12, there is an issue where Route Event Layers are slow to the point they're unusable, due to extensive geoprocessing history in the FC. Removing the geoprocessing history in a FGDB copy via XML solves the issue, proving that the geoprocessing history is the problem.
It would be ideal to have a GP tool to remove the geoprocessing history from existing geodatabase feature classes, rather than manually fiddling with XML.
Related: Don't track GP tools like Add Relate in FC geoprocessing history
I knew GP History could be saved in MXD/APRX files and cause bloat (which is why I regularly clean long-running projects), but I had no idea it could be stored in a Feature Class. Shocking!
Automated metadata management in ArcGIS Pro uses the arcpy.metadata module, rather than a geoprocessing toolbox/toolset.
https://pro.arcgis.com/en/pro-app/latest/arcpy/metadata/what-is-the-metadata-module.htm
To remove geoprocessing history/lineage from a dataset's metadata:
md = arcpy.metadata.Metadata(path_to_dataset)
md.deleteContent('GPHISTORY')
md.save()
And to make it so when you run tools it is not saved in the metadata, use this Geoprocessing Option
@DrewFlater Thanks. That helps.
With that said, I think this idea is still valid. My preference is to always use OOTB tools, rather than ask users (non-coders) to use Python scripts.
Saying "it can be done with Python" applies to most existing GP tools. I don't see how this case is different. Why not allow us to request a GP tool?
Hi,
The Metadata editor in Pro 3.3 includes an interactive table that lists the Geoprocessing History/lineage stored in the dataset's metadata, which you can delete or export.
So you can choose to use the interactive experience, or for automation use the arcpy.metadata module. There isn't really a position for a geoprocessing tool given these alternatives.
A note about the path_to_dataset in Python from @DrewFlater :
...Python uses the \ backslash character as an escape character, so you need to either use double backslashes, use forward slashes, or put an r at the front of the string to indicate raw string.
@DrewFlater I wonder if it would be more accurate to say this idea was Implemented in 3.3, rather than Already Offered.
What's new in ArcGIS Pro 3.3 - Metadata
You can delete geoprocessing history items when you edit an item's metadata.
The idea was marked as Already Offered based on the arcpy.metadata command to delete geoprocessing history, which has been available for several releases. The enhancement in Pro 3.3 supports a UI to accomplish the same goal through the metadata editor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.