Improving the speed of arcpy.ChangeVersion_management in ArcGIS Pro

288
1
07-14-2021 03:11 AM
MattHowe
New Contributor III

I'm creating a script that includes a section that appends a feature from the 'memory' workspace to a newly created version of our SDE.DEFAULT database. When running the script I've noticed that the arcpy.ChangeVersion_management geoprocessing tool is cripplingly slow, just to switch to the new version. In addition, appending one feature to the new version if also painfully slow. The code is below but does anyone have any ideas as to how it can be speeded up?

 

if upload_to_SDE == "true":
    arcpy.SetProgressorLabel("Preparing new SDE version")
    arcpy.AddMessage("Creating SDE version")
    try:
        arcpy.env.workspace = sde_path
        parent_version = "SDE.DEFAULT"
        version_name = "TEST_VERSION"
        sde_fl = "SurveyAreaFL"
        full_version_name = f"OPS${get_current_user()}.{version_name}"
        # Create new version for the new extent
        arcpy.CreateVersion_management(sde_path, parent_version, version_name, "PUBLIC")
        arcpy.AddMessage(f"Version: {full_version_name} created")
        arcpy.management.MakeFeatureLayer(survey_area_path, sde_fl)
        arcpy.SetProgressorLabel("Changing version")
        arcpy.ChangeVersion_management(sde_fl, "TRANSACTIONAL", full_version_name)
        arcpy.AddMessage(f"Version changed: ADM.SurveyArea {full_version_name}")
        arcpy.SetProgressorLabel("Appending features")
        arcpy.Append_management(r"memory\NewSurveyArea", sde_fl, "TEST")
        arcpy.AddMessage("Data appended to SDE: SurveyArea")
    except arcpy.ExecuteError:
        exec_error()
    except:
        traceback_error()

 

 

 

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

@KoryKramer 's post provides tips on performance problems

Troubleshooting Performance Issues in ArcGIS Pro - Esri Community

or Announcing the ArcGIS Pro Performance Assessment Tool (PAT) (esri.com)

other than that, working with Tech Support may be your remaining option.


... sort of retired...
0 Kudos