Summary
Creates a replica using a specified list of feature classes, layers, feature datasets, and tables from a remote geodatabase using a geodata service published on ArcGIS Server.
Usage
The source must be a geodata service representing a remote enterprise geodatabase. The destination can be either a local or a remote geodatabase.
The data that will be replicated must be versioned but not with the option to move edits to base.
For check-out and one-way replicas, the child replica geodatabase can be an enterprise, file, or personal 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.
The default for feature classes is to replicate all features. The default filter for tables is Schema Only; only the schema for the table will be replicated. If you set the Extent environment or specify replica geometry features, it will be applied as a spatial filter in which only features intersecting the extent will be replicated. Tables will also include rows that are related to rows that are part of the replica.
The Replica Geometry Features parameter can be used to define the replica geometry. You can also use the Extent environment setting to define the replica geometry.
- If only the Replica Geometry Features parameter is set, only data intersecting the replica geometry features will be replicated.
- If only the Extent environment is set, only data intersecting the extent will be replicated.
- If both the Replica Geometry Features parameter and the Extent environment are set, the Replica Geometry Features parameter will be used.
- If neither the Replica Geometry Features parameter 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 spatial, 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 Preparing data for replication for more information.
The Re-use Schema parameter options are only available for checkout replicas.
Syntax
arcpy.management.CreateReplicaFromServer(in_geodataservice, datasets, in_type, out_geodatabase, out_name, {access_type}, {initial_data_sender}, {expand_feature_classes_and_tables}, {reuse_schema}, {get_related_data}, {geometry_features}, {archiving})
Parameter | Explanation | Data Type |
in_geodataservice | The geodata service representing the geodatabase from which the replica will be created. The geodatabase referenced by the geodata service must be an enterprise geodatabase. | GeoDataServer |
datasets [dataset_name,...] | The list of the feature datasets, stand-alone feature classes, tables, and stand-alone attributed relationship classes from the geodata service to replicate. | String |
in_type | Specifies the type of replica to create.
| String |
out_geodatabase | The local 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 replicas, the child geodatabase must be an enterprise geodatabase. For one-way and check-out replicas, the geodatabase can be a file or enterprise geodatabase. File geodatabases must exist before running this tool. | Workspace ; GeoDataServer |
out_name | The name that identifies the replica. | String |
access_type (Optional) | Specifies the type of replica access.
| String |
initial_data_sender (Optional) | Specifies 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.
| String |
expand_feature_classes_and_tables (Optional) | Specifies whether expanded feature classes and tables—such as those in geometric networks, topologies, or relationship classes—will be added.
| String |
reuse_schema (Optional) | Specifies whether a geodatabase that contains the schema of the data to be replicate will be reused. This reduces the amount of time required to replicate the data. This option is only available for check-out replicas.
| String |
get_related_data (Optional) | Specifies whether rows related to rows already in the replica will be replicated. 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.
| 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.
| Boolean |
Derived Output
Name | Explanation | Data Type |
out_geodata | The updated geodata service. | Workspace;GeoDataServer |
output_name | The output replica name. | String |
Code sample
CreateReplicaFromServer example 1 (Python window)
The following Python window script demonstrates how to use the CreateReplicaFromServer function in immediate mode.
import arcpy
arcpy.env.workspace = "C:/Data/MySDEdata.sde"
arcpy.CreateReplicaFromServer_management(
"C:/MyServerConn/RoadMap.GeoDataServer", "Roads", "TWO_WAY_REPLICA",
arcpy.env.workspace, "MajorRoads_replica", "FULL", "CHILD_DATA_SENDER",
"USE_DEFAULTS", "DO_NOT_REUSE", "GET_RELATED")
CreateReplicaFromServer example 2 (stand-alone script)
The following stand-alone script demonstrates how to use the CreateReplicaFromServer function.
# Name: CreateReplicaFromServer_Example2.py
# Description: Creates a two-way replica from a geodata service
# Import system modules
import arcpy
# Set workspace
arcpy.env.workspace = "C:/Data/MySDEdata.sde"
# Set local variables
gisServer = "C:/MyServerConn/RoadMap.GeodataServer"
in_datasets = "Roads; Streets"
replica_type = "TWO_WAY_REPLICA"
out_workspace = env.workspace
replica_name = "MajorRoads_replica"
access_type = "FULL"
initial_sender = "CHILD_DATA_SENDER"
expand = "USE_DEFAULTS"
reUse = "DO_NOT_REUSE"
related = "GET_RELATED"
replica_geometry = "LA_County"
archiving = "DO_NOT_USE_ARCHIVING"
# Execute CreateReplicaFromServer
arcpy.CreateReplicaFromServer_management(
gisServer, in_datasets, replica_type, out_workspace, replica_name,
access_type, initial_sender, expand, reUse, related, replica_geometry,
archiving)
Environments
Licensing information
- Basic: No
- Standard: Yes
- Advanced: Yes