Create Replica (Data Management)

License Level:BasicStandardAdvanced

Summary

Creates a replica to a personal, file, or SDE geodatabase from a specified list of feature classes, layers, datasets, and/or tables in an ArcSDE geodatabase.

Usage

Syntax

CreateReplica_management (in_data, in_type, out_geodatabase, out_name, {access_type}, {initial_data_sender}, {expand_feature_classes_and_tables}, {reuse_schema}, {get_related_data}, {geometry_features}, archiving)
ParameterExplanationData Type
in_data
[in_data,...]

The data to be replicated. This list consists of layers and tables referencing versioned, editable data from an ArcSDE geodatabase.

Layer; Table View; Dataset
in_type

The kind of replica to create.

  • TWO_WAY_REPLICA Changes can be sent between child and parent replicas in both directions.
  • ONE_WAY_REPLICAChanges are sent from the parent replica to the child replica only.
  • CHECK_OUTData is replicated, edited, and checked back in one time.
  • ONE_WAY_CHILD_TO_PARENT_REPLICAChanges are sent from the child replica to the parent replica only.
String
out_geodatabase

The local geodatabase or geodata service that will host the child replica. Geodata services are used to represent remote geodatabases. The geodatabase can be an ArcSDE, file, or personal geodatabase. For two-way replicas the child geodatabase must be ArcSDE. For one-way and check-out replicas the geodatabase can be personal, file, or ArcSDE. Personal or file geodatabases must already exist before running this tool.

Workspace ; GeoDataServer
out_name

The name that identifies the replica.

String
access_type
(Optional)

The type of access you want:

  • FULLSupports complex types (topologies and geometric networks) and requires the data to be versioned.
  • SIMPLEThe data on the child is not versioned and must be simple. This allows the replica to be interoperable. Nonsimple features in the parent (for example, features in geometric networks and topologies) are converted to simple features (for example, point, line, and polygon feature classes).
String
initial_data_sender
(Optional)

Used by replication to determine which replica can send changes when in disconnected mode. If you are working in a connected mode, this parameter is inconsequential. This ensures that the relative replica doesn't send updates until the changes are first received from the initial data sender.

  • CHILD_DATA_SENDER
  • PARENT_DATA_SENDER
String
expand_feature_classes_and_tables
(Optional)

Specifies whether you will include expanded feature classes and tables, such as those found in geometric networks, topologies, or relationship classes.

  • USE_DEFAULTSAdds the expanded feature classes and tables related to the feature classes and tables in the replica. The default for feature classes is to replicate all features; the default for tables is to replicate the schema only. If a spatial filter has been defined it will be applied to feature classes.
  • ADD_WITH_SCHEMA_ONLYAdds only the schema for the expanded feature classes and tables.
  • ALL_ROWSAdds all rows for expanded feature classes and tables.
  • DO_NOT_ADDDoesn't add expanded feature classes and tables.
String
reuse_schema
(Optional)

Indicates whether to reuse a geodatabase that contains the schema of the data you want to replicate. This reduces the amount of time required to replicate the data. This option is only available for check-out replicas.

  • DO_NOT_REUSEDo not reuse schema. This is the default.
  • REUSEReuse schema.
String
get_related_data
(Optional)

Specifies whether to replicate rows related to rows already in the replica. For example, consider a feature (f1) inside the replication filter and a related feature (f2) from another class outside the filter. Feature f2 is included in the replica if you choose to get related data.

  • DO_NOT_GET_RELATEDDo not replicate related rows.
  • GET_RELATEDReplicate related data. This is the default.
String
geometry_features
(Optional)

The features used to define the area to replicate.

Feature Layer
archiving

Specifies whether to use the archive class to track changes instead of using the versioning delta tables. This is only available for one-way replicas.

  • ARCHIVINGUses archiving to track changes.
  • DO_NOT_USE_ARCHIVINGDoes not use archiving to track changes. This is the default.
Boolean

Code Sample

CreateReplica example 1 (Python window)

The following Python Window script demonstrates how to use the CreateReplica function in the Python window.

import arcpy
from arcpy import env
env.workspace = "C:/Data/MySDEdata.sde"
arcpy.CreateReplica_management("roads", "ONE_WAY_REPLICA", "C:\Data\MyTargetGDB.gdb", "MyReplica", "FULL", \
"PARENT_DATA_SENDER", "USE_DEFAULTS", "DO_NOT_REUSE", "TRUE")
CreateReplica example 2 (stand-alone Python script)

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

# Name: CreateReplica_Example2.py
# Description: Create a one-way replica of a Feature Dataset to a file geodatabase. 

# Import system modules
import arcpy
from arcpy import env

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

# Set local variables
in_data = "Parks" # a feature dataset
replica_type = "ONE_WAY_REPLICA"
output_workspace = "C:\Data\MyTargetGDB.gdb"
replica_name = "MyReplica"
access_type = "FULL"
initial_sender = "PARENT_DATA_SENDER"
expand = "USE_DEFAULTS"
reuse_schema = "DO_NOT_REUSE"
get_related = "GET_RELATED"
replica_geometry = "LA_County"
archiving = "DO_NOT_USE_ARCHIVING"

# Execute CreateReplica
arcpy.CreateReplica_management(in_data, replica_type, output_workspace, replica_name, access_type, \
initial_sender, expand, reuse_schema, get_related, replica_geometry, archiving)

Environments

Related Topics

Licensing Information

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