How To: Automate reconcile, post and compress processes

Summary

Reconciling and posting versions in a multi-tiered versioning workflow such as: child to parent to default followed by compress is a typical workflow performed by GIS administrators or managers.

Procedure

The Python script below provides a method for automating the reconcile, post, and compress workflow. The workflow assumes three tiers (Default > Parent > Child), such that child versions are reconciled to parent version and parent versions are reconciled to default.

Note:The script also compresses the geodatabase to state 0, deletes all versions except DEFAULT and re-creates the child versions.

Modify the vtree variable in the script according to the version tree.

For example, populate parent and child versions in the following manner:'Parent':'Child', etc. Do not list DEFAULT.

In the example below, the version named SDE.Child is a child of SDE.Parent. The version named SDE.Edit is a child of SDE.QA.

Example:

vTree = {'SDE.Parent':'SDE.Child','SDE.QA':'SDE.Edit'}

Set the workspace variable to reference the path to the sde connection file. Be sure the sde connection file user is the SDE Administrator:

Example:

workspace = r"Database Connections\MXD2.sde"

Set the defaultVersion variable to reference either the dbo.DEFAULT or sde.DEFAULT in accordance to the environment.

Example:

defaultVersion = "sde.DEFAULT"

Finally, set the logging variables according to your preference, that is, the naming convention and location of the logs.