Skip to content

Instantly share code, notes, and snippets.

@BrunoCaimar
Created April 13, 2012 20:14
Show Gist options
  • Save BrunoCaimar/2379808 to your computer and use it in GitHub Desktop.
Save BrunoCaimar/2379808 to your computer and use it in GitHub Desktop.
Batch Reconcile
#http://resourcesbeta.arcgis.com/en/help/main/10.1/index.html#/Reconcile_Versions/00170000015p000000/
# Name: ReconcileVersions.py
# Description: reconciles all versions owned by a user with SDE.Default
# Import system modules
import arcpy, os
from arcpy import env
# set workspace
workspace = 'Database Connections//[email protected]'
# set the workspace environment
env.workspace = workspace
# Use a list comprehension to get a list of version names where the owner
# is the current user and make sure sde.default is not selected.
verList = [ver.name for ver in arcpy.da.ListVersions() if ver.isOwner
== True and ver.name.lower() != 'sde.default']
arcpy.ReconcileVersions_management(workspace,"ALL_VERSIONS","SDE.Default",verList,"LOCK_AQUIRED","NO_ABORT","BY_OBJECT","FAVOR_TARGET_VERSION","NO_POST","KEEP_VERSION","c:\RecLog.txt")
print 'Reconciling Complete'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment