I'm working on a python script to remove Geoprocessing History at the Database, Feature Class, Table, Feature Dataset and feature classes within any feature datasets. ESRI provides this page which contains Python code to do most of it; it takes care of root level feature class gp history as well as gp history within feature datasets. I'm tinkering with the code to get any gp history for tables as well as the database itself.
The real question I have for this forum is: Does anyone know where the actual GP history is stored? You can view GP history under the Description Tab for a given feature/gdb in ArcCatalog, and the script ESRI provides, somehow uses an xlst style sheet to get rid of gp history; it's a bit of a convoluted process, and I'd rather not get into that here.
It would be cool to be able to check for gp history before actually running the script. Psuedo code might look like:
''' for a given fgdb, fc, table, fds/fc... '''
if gp_history exists:
run the ESRI_mojo
else:
pass
But I don't know where to look for it. I thought maybe arcpy.describe might have it, but no such luck.
There is an post from June 2018 that discusses removing gp history in ArcGIS Pro, but the metadata related tools are not available in Pro like arcpy.XSLTransform_conversion and arcpy.MetadataImporter_conversion which the ESRI script relies upon...
I've posted to the Metadata group only because I can't think of another more logical space: Curtis Price, if you see this and can think of where it ought to go, please cross post.
Solved! Go to Solution.
Does anyone know where the actual GP history is stored?
It is stored in XML tags in the items metadata. This location varies depending on data formats, for shapefiles, it is in a file named shapefile_name.shp.xml, for Esri grids it is inside the grid's data folder: gridname\metadata.xml, in file geodatabase and enteprise geodatabase, it is stored in a table containing XML data that you should not touch. The complicated methods you describe seek and destroy tags within those XML metadata files.
If you want to search the XML code for GP history that may be a fast way to determine whether it is there, ie read the text and search for the tags, as would not require fairly complex (and time consuming) XML parsing and transforms. However if you wanted to check gdb dataset GP history, you would need to export the table of XML data out using tools from the Conversion toolbox (not supported in Pro) and then look through the XML text file.
You mentioned that you can't see the geoprocessing history in the Item/Description view. You can if you change the metadata style to anything besides the default Item Description style. The way the metadata is viewed in ArcMap or ArcCatalog is by reading the XML from the item's metadata and translating it to HTML using a stylesheet, different metadata styles cause different stylesheets to be used.
Does this help?
Does anyone know where the actual GP history is stored?
It is stored in XML tags in the items metadata. This location varies depending on data formats, for shapefiles, it is in a file named shapefile_name.shp.xml, for Esri grids it is inside the grid's data folder: gridname\metadata.xml, in file geodatabase and enteprise geodatabase, it is stored in a table containing XML data that you should not touch. The complicated methods you describe seek and destroy tags within those XML metadata files.
If you want to search the XML code for GP history that may be a fast way to determine whether it is there, ie read the text and search for the tags, as would not require fairly complex (and time consuming) XML parsing and transforms. However if you wanted to check gdb dataset GP history, you would need to export the table of XML data out using tools from the Conversion toolbox (not supported in Pro) and then look through the XML text file.
You mentioned that you can't see the geoprocessing history in the Item/Description view. You can if you change the metadata style to anything besides the default Item Description style. The way the metadata is viewed in ArcMap or ArcCatalog is by reading the XML from the item's metadata and translating it to HTML using a stylesheet, different metadata styles cause different stylesheets to be used.
Does this help?
Thanks Curtis.
You mentioned that you can't see the geoprocessing history in the Item/Description view...
What I meant by
But I don't know where to look for it
is I don't know how to check if gp processing history exists for a given gdb, feature class or table. I was just thinking if it doesn't exist, I'd pass over that item instead of running the process .
I got the ESRI script adjusted to my liking, and it tests well on a fgdb. Today I'll test it in a loop of several egdb's.