ListReplicas (arcpy.da)

サマリ

Lists the replicas in the workspace.

説明

You can specify the path to an ArcSDE connection file as an argument to the function or you can set the workspace environment to the ArcSDE Connection file and call the ListReplicas function without any arguments.

構文

ListReplicas (workspace)
パラメータ説明データ タイプ
workspace

A geodatabase workspace.

String
戻り値
データ タイプ説明
Replica

The Python List returned from the function containing Replica objects.

コードのサンプル

ListReplicas example 1

For every replica in a workspace that is a sender, call Export Data Change Message.

import arcpy
import os

sdeConnection = "Database Connections/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 = "Database Connections/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)

関連トピック

4/26/2014