Summary
Reconciles a version or multiple versions with a target version.
Usage
The reconcile process requires that you are the only user currently editing the version and the only user who will edit the version throughout the reconcile process until you save or post.
The reconcile process requires that you have full permissions to all the feature classes that have been modified in the version being edited.
Versioning tools work with enterprise geodatabases. File geodatabases do not support versioning.
This tool supports reconcile/post for data published from a branch workspace with version management capabilities enabled. Reconcile/post for branch versioning via a geodatabase connection file is not supported.
The geodatabase is designed to efficiently manage and support long transactions using versions.
The reconcile process detects differences between the edit version and the target version and flags these differences as conflicts. If conflicts exist, they should be resolved.
After running the reconcile process successfully with the Reconcile all versions option, all versions in the geodatabase will appear the same.
Syntax
arcpy.management.ReconcileVersions(input_database, reconcile_mode, {target_version}, {edit_versions}, {acquire_locks}, {abort_if_conflicts}, {conflict_definition}, {conflict_resolution}, {with_post}, {with_delete}, {out_log}, {proceed_if_conflicts_not_reviewed}, {reconcile_checkout_versions})
Parameter | Explanation | Data Type |
input_database | The enterprise geodatabase that contains the versions to be reconciled. The default is to use the geoprocessing workspace environment. For branch versioning, this will be the feature service URL (that is, https://mysite.mydomain/server/rest/services/ElectricNetwork/FeatureServer). | Workspace |
reconcile_mode | Specifies the versions that will be reconciled when the tool is executed. If the input is a branch workspace, the only valid option for this parameter is to reconcile all versions.
| String |
target_version (Optional) | The name of any version in the direct ancestry of the edit version, such as the parent version or the default version. It typically contains edits from other versions that you want included in the edit version. If the input is a branch workspace, the only valid option for this parameter is to reconcile with the default version. | String |
edit_versions [edit_versions,...] (Optional) | The name of the edit version or versions to be reconciled with the selected target version. This can be an individual version name or a list of version names. | String |
acquire_locks (Optional) | Specifies whether feature locks will be acquired.
| Boolean |
abort_if_conflicts (Optional) | Specifies whether the reconcile process will be aborted if conflicts are found between the target version and the edit version during the reconcile process.
| Boolean |
conflict_definition (Optional) | Specifies whether the conditions required for a conflict to occur are defined by object (row) or by attribute (column).
| String |
conflict_resolution (Optional) | Specifies the resolution if a conflict is detected. If the input is a branch workspace, the default is to favor the edit version.
| String |
with_post (Optional) | Specifies whether the current edit session will be posted to the reconciled target version.
| Boolean |
with_delete (Optional) |
Specifies whether the reconciled edit version will be deleted after posting. This parameter only applies if the with_post parameter is set to POST.
| Boolean |
out_log (Optional) | The name and location where the log file will be written. The log file is an ASCII file containing the contents of the geoprocessing messages. | File |
proceed_if_conflicts_not_reviewed (Optional) | Specifies whether the reconcile will proceed if there are unreviewed conflicts that exist before starting the reconcile process. If you choose to proceed, outstanding conflicts from previous sessions will be lost upon tool execution. This parameter is only applicable to branch versioning.
| Boolean |
reconcile_checkout_versions (Optional) |
Specifies whether the reconcile will include checkout replica versions. If you are creating a checkout replica as part of a geodatabase replication workflow, an associated version is created in the geodatabase. This option allows you to include or remove these types of versions from the list of versions to be reconciled. This parameter is not applicable for branch versioning.
| Boolean |
Derived Output
Name | Explanation | Data Type |
out_workspace | The updated input workspace. | Workspace |
Code sample
The following stand-alone script demonstrates how to use the ReconcileVersions tool to reconcile all versions owned by the user specified in the database connection file.
# Name: ReconcileVersions.py
# Description: Reconciles all versions owned by a user with SDE.Default
# Import system modules
import arcpy, os
# Set workspace
workspace = 'C:/Data/connections/bender@production.sde'
# Set the workspace environment
arcpy.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_ACQUIRED",
"NO_ABORT",
"BY_OBJECT",
"FAVOR_TARGET_VERSION",
"NO_POST",
"KEEP_VERSION",
"c:\RecLog.txt")
print('Reconciling Complete')
Environments
Licensing information
- Basic: No
- Standard: Yes
- Advanced: Yes