Summary
Lists the replicas in the workspace.
Discussion
You can specify the path to a connection file as an argument to the function or you can set the workspace environment to the connection file and call the ListReplicas function without any arguments.
Syntax
ListReplicas (workspace)
Parameter | Explanation | Data Type |
workspace | A geodatabase workspace. | String |
Return Value
Data Type | Explanation |
Replica | A list returned from the function containing Replica objects. |
Code sample
ListReplicas example 1
For every replica in a workspace that is a sender, call the ExportDataChangeMessage function.
import arcpy
import os
sdeConnection = "C:/Data/toolboxDEFAULTVersion.sde"
outLocation = "C:/data"
for replica in arcpy.da.ListReplicas(sdeConnection):
# If the replica is a sender, call ExportDataChangeMessage
if replica.isSender:
changesFile = os.path.join(outputLocation,
"changes_{0}.gdb".format(replica.name))
arcpy.ExportDataChangeMessage_management(sdeConnection,
changes,
replica.name)
ListReplicas example 2
Print all replicas that are in conflict.
import arcpy
sdeConnection = "C:/Data/toolboxDEFAULTVersion.sde"
# Print the name of the replicas that are in conflict
#
for replica in arcpy.da.ListReplicas(sdeConnection):
if replica.hasConflicts:
print(replica.name)