Select to view content in your preferred language

Change/Edit Version within Geoprocessing Tool

804
2
04-10-2019 11:18 AM
AdelaideZumwalt1
Frequent Contributor

When I run my script in the Python window in ArcGIS Pro 2.3.2 all changes are made in the version specified. When I run the same script as a geoprocessing tool all changes are made to DEFAULT. Is it possible to create a geoprocessing tool that changes the version and edits within that version? 

import arcpy
import glob

workOrder = arcpy.GetParameterAsText(0)

# Create version
arcpy.CreateVersion_management("C:/Users/azumwalt.UECOOP/AppData/Roaming/ESRI/Desktop10.4/ArcCatalog/ElectricModel - azumwalt.sde", "DEFAULT", workOrder+"_TEST", "PUBLIC")
arcpy.ChangeVersion_management("Consumer_SQL02", 'TRANSACTIONAL', "DBO."+workOrder+"_TEST", None)

0 Kudos
2 Replies
MatthewDriscoll
MVP Alum

After you create a version and before you change it try creating a connection to it.   

CreateDatabaseConnection_management 

0 Kudos
AdelaideZumwalt1
Frequent Contributor

Thanks, I'll try that.

0 Kudos