Skip to content

Instantly share code, notes, and snippets.

@dersteppenwolf
Created October 30, 2015 20:42
Show Gist options
  • Save dersteppenwolf/0c363e79590ace14898d to your computer and use it in GitHub Desktop.
Save dersteppenwolf/0c363e79590ace14898d to your computer and use it in GitHub Desktop.
import arcpy
import os
#"unregistering as versioned" multiple datasets using arcpy
try:
conn_path = "c:/temp/RUTACONN.SDE"
datasets = ["DATASET_01", "DATASET_02", "DATASET_03", "DATASET_04", "DATASET_05"]
for dataset in datasets:
dataset_path = os.path.join(conn_path,dataset )
print dataset_path
datasetVersioned = arcpy.Describe(dataset_path).isVersioned
print datasetVersioned
if datasetVersioned:
try:
arcpy.UnregisterAsVersioned_management(dataset_path,"NO_KEEP_EDIT", "COMPRESS_DEFAULT")
except Exception as e:
print arcpy.GetMessages()
except Exception as e:
print arcpy.GetMessages()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment