Create Replica (Data Management)

Summary

Creates a replica in a geodatabase from a specified list of feature classes, layers, datasets, and tables in an enterprise geodatabase.

Usage

  • All datasets must be from the same enterprise geodatabase.

  • The data that will be replicated must be registered as traditional versioned but not with the option to move edits to base.

  • The connected database user must also have write permissions to the data.

  • For two-way and both types of one-way replicas, all datasets must have a GlobalID column.

  • For check-out and one-way replicas, the child replica geodatabase can be an enterprise or file geodatabase.

  • For two-way and one-way child-to-parent replicas, the child geodatabase must be an enterprise geodatabase.

  • To use archiving for one-way replicas, the parent workspace must be connected to the default version. For one-way child-to-parent replicas, the child workspace must be connected to the default version.

  • You can replicate all of the data in the datasets or replicate subsets of the data. You can specify the subsets of data to be replicated in the following ways:

    • Use definition queries on the data.
    • Specify an extent using the geoprocessing Extent environment setting.
    • Use the Replica Geometry Features parameter in this tool.

  • For tables, the default filter is Schema Only; only the schema for the table will be replicated. To apply a filter to a table, first create a table view with the desired filters. Then use this as input to the Create Replica tool. See Make Table View for more information. For more information about filters and replication, see Prepare data for replication.

  • You can use the Replica Geometry Features parameter or the Extent environment setting to define the replica geometry.

    • If a value is provided for the Replica Geometry Features parameter, it will be used as the replica geometry.
    • If no value is provided for the Replica Geometry Features parameter, the Extent environment will be used as the replica geometry.
    • If neither the Replica Geometry Features parameter value nor the Extent environment is specified, the full extent of the data will be used.

  • The replica geometry features can be points, lines, or polygons.

  • A feature layer used for the replica geometry features can contain one or more features. If there is more than one, the geometries are merged, and only data that intersects the merged geometries will be replicated.

  • If filters (such as selection or definition query) have been defined on the replica geometry features, only features that satisfy these filters will be used to define the replica geometry. See Prepare data for replication for more information.

  • The Re-use Schema parameter options are only available for checkout replicas.

Parameters

LabelExplanationData Type
Replica Datasets

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

Table View; Dataset
Replica Type

Specifies the type of replica that will be created.

  • Two way replica Changes will be sent between child and parent replicas in both directions.
  • One way replicaChanges will be sent from the parent replica to the child replica only.
  • Check out replicaData will be replicated, edited, and checked back in one time.
  • One way child to parent replicaChanges will be sent from the child replica to the parent replica only.
String
Geodatabase to replicate data to
(Optional)

The geodatabase that will host the child replica. Geodata services are used to represent remote geodatabases. The geodatabase can be an enterprise or file geodatabase. For two-way and one-way-child-to-parent replicas, the child geodatabase must be an enterprise geodatabase. For one-way and checkout replicas, the geodatabase can be a file or enterprise geodatabase.

This parameter is required if the Output Type parameter is set to Geodatabase.

Workspace; GeoDataServer
Replica Name

The name that identifies the replica.

String
Replica Access Type
(Optional)

Specifies the type of replica access.

  • FullComplex types such as topologies, are supported and the data must be versioned. This is the default.
  • 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 topologies) will be converted to simple features (for example, point, line, and polygon feature classes).
String
Initial Data Sender
(Optional)

Specifies which replica will send changes when in disconnected mode. If you are working in a connected mode, this parameter is inconsequential. This ensures that the relative replica will not send updates until the changes are first received from the initial data sender.

  • Child data senderThe child replica will be the initial data sender. This is the default.
  • Parent data senderThe parent replica will be the initial data sender.
String
Expand Feature Classes and Tables
(Optional)

Specifies whether expanded feature classes and tables—such as those in networks, topologies, or relationship classes—will be added.

  • Use defaultsThe expanded feature classes and tables related to the feature classes and tables in the replica will be added. The default for feature classes is to replicate all features intersecting the spatial filter. If no spatial filter has been provided, all features will be included. The default for tables is to replicate the schema only. This is the default.
  • Add with schema onlyOnly the schema for the expanded feature classes and tables will be added.
  • All rowsAll rows for expanded feature classes and tables will be added.
  • Do not addNo expanded feature classes or tables will be added.
String
Re-use Schema
(Optional)

Specifies whether a geodatabase that contains the schema of the data to be replicated will be reused. This reduces the amount of time required to replicate the data. This parameter is only available for checkout replicas.

  • Do not reuseSchema will not be reused. This is the default.
  • ReuseSchema will be used.
String
Replicate Related Data
(Optional)

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

  • Do not get relatedRelated data will not be replicated.
  • Get relatedRelated data will be replicated. This is the default.
String
Replica Geometry Features
(Optional)

The features that will be used to define the area to replicate.

Feature Layer
Use archiving to track changes for 1 way replication
(Optional)

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

  • ArchivingArchiving will be used to track changes.
  • Do not use archivingArchiving will not be used to track changes. This is the default.
Boolean
Register existing data only
(Optional)

Specifies whether existing data in the child geodatabase will be used to register the replica datasets. The datasets in the child geodatabase must have the same names as the datasets in the parent database and be owned by the user that is connected to the child geodatabase.

  • Checked—Existing data in the child geodatabase will be used to register the replica.
  • Unchecked—Data in the parent geodatabase will be copied to the child geodatabase. This is the default.

Boolean
Output Type
(Optional)

Specifies the output type of the data that will be replicated.

  • GeodatabaseThe data will be replicated to an existing geodatabase. This is the default.
  • Xml fileThe data will be replicated to an XML workspace document.
  • New file geodatabaseThe data will be replicated to a new file geodatabase that will be created when the tool is run. Provide the location and name of the new file geodatabase in the File geodatabase location parameter. This option is only valid for one-way and checkout replicas.
String
XML file to replicate data to
(Optional)

The name and location of the .xml file that will be created.

This parameter is required if the Output Type parameter is set to Xml file.

File
All records for tables
(Optional)

Specifies whether all records or only the schema will be copied to the child geodatabase for tables that do not have filters applied (such as selections or definition queries).

Tables with applied filters will be honored.

  • Checked—For tables with no applied filters, all records will be copied to the child geodatabase for tables. This option will override the Expand Feature Classes and Tables parameter value.
  • Unchecked—For tables with no applied filters, only the schema will be copied to the child geodatabase for tables. Tables with applied filters will be honored. This is the default.

Boolean
File geodatabase location
(Optional)

The location of the file geodatabase that will be created to host the child replica. This parameter is required if the Output Type parameter is set to New file geodatabase and is only valid for one-way and checkout replicas.

Folder
File geodatabase name
(Optional)

The name of the file geodatabase that will be created to host the child replica. This parameter is required if the Output Type parameter is set to New file geodatabase and is only valid for one-way and checkout replicas.

String

Derived Output

LabelExplanationData Type
Output Child Workspace

The output child geodatabase.

Workspace
Output Replica Name

The name of the output replica.

String

arcpy.management.CreateReplica(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}, {register_existing_data}, {out_type}, {out_xml}, {all_records_for_tables}, {out_filegdb_folder_path}, {out_filegdb_name})
NameExplanationData Type
in_data
[in_data,...]

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

Table View; Dataset
in_type

Specifies the type of replica that will be created.

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

The geodatabase that will host the child replica. Geodata services are used to represent remote geodatabases. The geodatabase can be an enterprise or file geodatabase. For two-way and one-way-child-to-parent replicas, the child geodatabase must be an enterprise geodatabase. For one-way and checkout replicas, the geodatabase can be a file or enterprise geodatabase.

This parameter is required if the out_type parameter is set to GEODATABASE.

Workspace; GeoDataServer
out_name

The name that identifies the replica.

String
access_type
(Optional)

Specifies the type of replica access.

  • FULLComplex types such as topologies, are supported and the data must be versioned. This is the default.
  • 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 topologies) will be converted to simple features (for example, point, line, and polygon feature classes).
String
initial_data_sender
(Optional)

Specifies which replica will send changes when in disconnected mode. If you are working in a connected mode, this parameter is inconsequential. This ensures that the relative replica will not send updates until the changes are first received from the initial data sender.

  • CHILD_DATA_SENDERThe child replica will be the initial data sender. This is the default.
  • PARENT_DATA_SENDERThe parent replica will be the initial data sender.
String
expand_feature_classes_and_tables
(Optional)

Specifies whether expanded feature classes and tables—such as those in networks, topologies, or relationship classes—will be added.

  • USE_DEFAULTSThe expanded feature classes and tables related to the feature classes and tables in the replica will be added. The default for feature classes is to replicate all features intersecting the spatial filter. If no spatial filter has been provided, all features will be included. The default for tables is to replicate the schema only. This is the default.
  • ADD_WITH_SCHEMA_ONLYOnly the schema for the expanded feature classes and tables will be added.
  • ALL_ROWSAll rows for expanded feature classes and tables will be added.
  • DO_NOT_ADDNo expanded feature classes or tables will be added.
String
reuse_schema
(Optional)

Specifies whether a geodatabase that contains the schema of the data to be replicated will be reused. This reduces the amount of time required to replicate the data. This parameter is only available for checkout replicas.

  • DO_NOT_REUSESchema will not be reused. This is the default.
  • REUSESchema will be used.
String
get_related_data
(Optional)

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

  • DO_NOT_GET_RELATEDRelated data will not be replicated.
  • GET_RELATEDRelated data will be replicated. This is the default.
String
geometry_features
(Optional)

The features that will be used to define the area to replicate.

Feature Layer
archiving
(Optional)

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

  • ARCHIVINGArchiving will be used to track changes.
  • DO_NOT_USE_ARCHIVINGArchiving will not be used to track changes. This is the default.
Boolean
register_existing_data
(Optional)

Specifies whether existing data in the child geodatabase will be used to register the replica datasets. The datasets in the child geodatabase must have the same names as the datasets in the parent geodatabase.

  • REGISTER_EXISTING_DATAExisting data in the child geodatabase will be used to register the replica.
  • DO_NOT_USE_REGISTER_EXISTING_DATAData in the parent geodatabase will be copied to the child geodatabase. This is the default.
Boolean
out_type
(Optional)

Specifies the output type of the data that will be replicated.

  • GEODATABASEThe data will be replicated to an existing geodatabase. This is the default.
  • XML_FILEThe data will be replicated to an XML workspace document.
  • NEW_FILE_GEODATABASEThe data will be replicated to a new file geodatabase that will be created when the tool is run. Provide the location and name of the new file geodatabase in the out_filegdb_folder_path parameter. This option is only valid for one-way and checkout replicas.
String
out_xml
(Optional)

The name and location of the .xml file that will be created.

This parameter is required if the out_type parameter is set to XML_FILE.

File
all_records_for_tables
(Optional)

Specifies whether all records or only the schema will be copied to the child geodatabase for tables that do not have filters applied (such as selections or definition queries).

Tables with applied filters will be honored.

  • ALL_RECORDS_FOR_TABLESFor tables with no applied filters, all records will be copied to the child geodatabase. This option will override the expand_feature_classes_and_tables parameter value.
  • SCHEMA_ONLY_FOR_TABLES For tables with no applied filters, only the schema will be copied to the child geodatabase. Tables with applied filters will be honored. This is the default.
Boolean
out_filegdb_folder_path
(Optional)

The location of the file geodatabase that will be created to host the child replica. This parameter is required if the out_type parameter is set to NEW_FILE_GEODATABASE and is only valid for one-way and checkout replicas.

Folder
out_filegdb_name
(Optional)

The name of the file geodatabase that will be created to host the child replica. This parameter is required if the out_type parameter is set to NEW_FILE_GEODATABASE and is only valid for one-way and checkout replicas.

String

Derived Output

NameExplanationData Type
out_child_geodatabase

The output child geodatabase.

Workspace
output_replica_name

The name of the output replica.

String

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
arcpy.env.workspace = "C:/Data/MyData.sde"
arcpy.management.CreateReplica("roads", "ONE_WAY_REPLICA", 
                               "C:\Data\MyTargetGDB.gdb", "MyReplica", "FULL", 
                               "PARENT_DATA_SENDER", "USE_DEFAULTS", 
                               "DO_NOT_REUSE", "GET_RELATED")
CreateReplica example 2 (stand-alone 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

# Set workspace
arcpy.env.workspace = "C:/Data/MyData.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"

# Run CreateReplica
arcpy.management.CreateReplica(in_data, replica_type, output_workspace, 
                               replica_name, access_type, initial_sender, 
                               expand, reuse_schema, get_related, 
                               replica_geometry, archiving)

Related topics