In ArcGIS Pro, before Overwrite Web Layer, we need to analyze - show differences between existing service and a new (overwrite) service, keeping parameters consistent when republishing FeatureServices.
Example: Keeping layer IDs consistent
It will be more parameters to compare, so we need a general solution.
Possible workflow could be:
ArcGIS Pro 3.3.0
ArcGIS Enterprise 11.2
If you're comfortable with a bit of Python, the compare method on arcgis.features.GeoAccessor is pretty helpful.
from arcgis.gis import GIS
from arcgis.features import GeoAccessor, FeatureLayer
gis = GIS('your portal url', 'user', 'password')
existing = GeoAccessor.from_layer(FeatureLayer('feature service url'))
new = GeoAccessor.from_featureclass('file path') # this part will depend on where the new data comes from
comp_frames = existing.spatial.compare(new, 'id field')
You'd then be able to look at the contents of comp_frames, being three dataframes corresponding to rows added, modified, and deleted between the existing and new layers.
Each of those identified changes could be exported to file / feature service and further interacted with.
Thank you Josh @jcarlson
The code you provided could be very useful.
For our case, it does not compare schema/s of feature classes,
it does not compare parameters of a service Web Layer and local Map as we going to overwrite the Web Layer.
Example:
An existing service has two feature layers with layers' IDs "1" and "2"
As we going to overwrite the service, we have in a Map two layers, but accidentally, the layers' IDs are "3" and "4"
We are looking to solve that issue in particular (only layers' IDs) and as a general solution (all parameters of the service)
Regards,
Mark
Getting the schema from two layers or two dataframes is easy. Layer IDs are probably something you'd need to use the arcpy.mp module for.