Synchronize Changes (Data Management)

License Level:BasicStandardAdvanced

Summary

Synchronizes updates between two replica geodatabases in a direction specified by the user.

Usage

Syntax

SynchronizeChanges_management (geodatabase_1, in_replica, geodatabase_2, in_direction, conflict_policy, conflict_definition, reconcile)
ParameterExplanationData Type
geodatabase_1

The geodatabase hosting the replica to synchronize. The geodatabase may be local or remote.

Workspace ;GeoDataServer
in_replica

A valid replica with a parent contained within one input geodatabase and a child in the other input geodatabase.

String
geodatabase_2

The geodatabase hosting the relative replica. The geodatabase may be local or remote.

Workspace; GeoDataServer
in_direction

The direction in which you want changes to be sent: from geodatabase 1 to geodatabase 2, from geodatabase 2 to geodatabase 1, or to send changes in both directions. For check-out/check-in replicas or one-way replicas there is only one appropriate direction. If the replica is two-way then any of the three choices are available.

  • BOTH_DIRECTIONSChanges will be synchronized in both directions.
  • FROM_GEODATABASE2_TO_1Changes will be synchronized from Geodatabase 2 to Geodatabase 1.
  • FROM_GEODATABASE1_TO_2Changes will be synchronized from Geodatabase 1 to Geodatabase 2.
String
conflict_policy

Specifies how conflicts are resolved when they are encountered.

  • MANUALManually resolve conflicts in the versioning reconcile environment.
  • IN_FAVOR_OF_GDB1Conflicts resolve in favor of the Geodatabase 1.
  • IN_FAVOR_OF_GDB2Conflicts resolve in favor of the Geodatabase 2.
String
conflict_definition

Specifies how you would like to define conflicts:

  • BY_OBJECTDetects conflicts by row
  • BY_ATTRIBUTEDetects conflicts by column
String
reconcile
reconcile

Indicates whether to automatically reconcile once data changes are sent to the parent replica if there are no conflicts present. This option is only available for check-out/check-in replicas.

  • DO_NOT_RECONCILEDo not reconcile. This is the default.
  • RECONCILEReconcile.
Boolean

Code Sample

SynchronizeChanges Example (Python Window)

The following Python window example demonstrates how to use the SynchronizeChanges function in the Python window.

import arcpy
from arcpy import env
env.workspace = "C:/Data"
arcpy.SynchronizeChanges_management("MySDEdata.sde", "My2wayReplica", "MySDEdata_child.sde", "BOTH_DIRECTIONS", \
"IN_FAVOR_OF_GDB1", "BY_ATTRIBUTE", "")
SynchronizeChanges Example 2 (stand-alone Python script)

The following demonstrates how to use the SynchronizeChanges function in a stand-alone Python script.

# Name: SynchronizeChanges_Example2.py
# Description: Synchronizes changes for a one way replica from the Parent 
# to the child replica geodatabase. The parent is an ArcSDE workspace, and the child is file geodatabase.

# Import system modules
import arcpy
from arcpy import env

# Set workspace
env.workspace = "C:/Data"

# Set local variables
replica_gdb1 = "MySDEdata.sde"
replica_gdb2 = "Counties_replica.gdb"
replica_name = "MyOneWayReplica"
sync_direction = "FROM_GEODATABASE1_TO_2"
conflict_policy = "" 						# Not applicable for one way replicas, there is not conflict detection.
conflict_detection = ""    # Not applicable for one way replicas, there is not conflict detection.
reconcile = ""             # Only applicable for Checkout replicas

# Execute SynchronizeChanges
arcpy.SynchronizeChanges_management(replica_gdb1, replica_name, replica_gdb2, sync_direction, conflict_policy, \
conflict_detection, reconcile)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: No
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015