Synchronize Changes (Data Management)

Summary

Synchronizes updates between two replica geodatabases in a specified direction.

Usage

  • Two-way, one-way, and check-out replicas can be synchronized with this tool.

  • The replica geodatabases can be local geodatabases or geodata services.

  • Once synchronized, the changes (edits) will be reflected in the target geodatabase and viewable by all users.

Parameters

LabelExplanationData Type
Geodatabase 1

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

Workspace; GeoDataServer
Replica

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

String
Geodatabase 2

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

Workspace; GeoDataServer
Direction

Specifies the direction in which the changes will be synchronized: from geodatabase 1 to geodatabase 2, from geodatabase 2 to geodatabase 1, or 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, all of the choices are available.

  • Both directionsChanges will be synchronized in both directions. This is the default.
  • From geodatabase 2 to geodatabase 1Changes will be synchronized from geodatabase 2 to geodatabase 1.
  • From geodatabase 1 to geodatabase 2Changes will be synchronized from geodatabase 1 to geodatabase 2.
String
Conflict Resolution Policy

Specifies how conflicts will be resolved when they are encountered.

  • Manually resolve conflictsConflicts will be resolved manually in the versioning reconcile environment.
  • Resolve in favor of geodatabase 1Conflicts will be resolved in favor of geodatabase 1. This is the default.
  • Resolve in favor of geodatabase 2Conflicts will be resolved in favor of geodatabase 2.
String
Conflict Definition

Specifies how conflicts will be defined.

  • Conflicts defined by rowChanges to the same row or feature in the parent and child versions will conflict during reconcile. This is the default.
  • Conflicts defined by column Only changes to the same attribute (column) of the same row or feature in the parent and child versions will be flagged as a conflict during reconcile. Changes to different attributes will not be considered a conflict during reconcile.
String

Derived Output

LabelExplanationData Type
Output Geodatabase 1

The geodatabase hosting the replica to synchronize.

Workspace; GeoDataServer
Output Geodatabase 2

The geodatabase hosting the relative replica.

Workspace; GeoDataServer

arcpy.management.SynchronizeChanges(geodatabase_1, in_replica, geodatabase_2, in_direction, conflict_policy, conflict_definition)
NameExplanationData Type
geodatabase_1

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

Workspace; GeoDataServer
in_replica

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

String
geodatabase_2

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

Workspace; GeoDataServer
in_direction

Specifies the direction in which the changes will be synchronized: from geodatabase 1 to geodatabase 2, from geodatabase 2 to geodatabase 1, or 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, all of the choices are available.

  • BOTH_DIRECTIONSChanges will be synchronized in both directions. This is the default.
  • 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 will be resolved when they are encountered.

  • MANUALConflicts will be resolved manually in the versioning reconcile environment.
  • IN_FAVOR_OF_GDB1Conflicts will be resolved in favor of geodatabase 1. This is the default.
  • IN_FAVOR_OF_GDB2Conflicts will be resolved in favor of geodatabase 2.
String
conflict_definition

Specifies how conflicts will be defined.

  • BY_OBJECTChanges to the same row or feature in the parent and child versions will conflict during reconcile. This is the default.
  • BY_ATTRIBUTE Only changes to the same attribute (column) of the same row or feature in the parent and child versions will be flagged as a conflict during reconcile. Changes to different attributes will not be considered a conflict during reconcile.
String

Derived Output

NameExplanationData Type
out_geodatabase_1

The geodatabase hosting the replica to synchronize.

Workspace; GeoDataServer
out_geodatabase_2

The geodatabase hosting the relative replica.

Workspace; GeoDataServer

Code sample

SynchronizeChanges example (Python window)

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


import arcpy
arcpy.env.workspace = "C:/Data"
arcpy.SynchronizeChanges_management("MyData.sde", "My2wayReplica", 
                                    "MyData_child.sde", "BOTH_DIRECTIONS",
                                    "IN_FAVOR_OF_GDB1", "BY_ATTRIBUTE")
SynchronizeChanges example 2 (stand-alone 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 enterprise 
#              geodatabase workspace, and the child is file geodatabase.

# Import system modules
import arcpy

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

# Set local variables
replica_gdb1 = "MyData.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)

Related topics