Summary
A replica is a copy of an enterprise geodatabase dataset. You can work independently with replicas and synchronize changes with the data's original enterprise geodatabase.
This tool creates a replica in a personal, file, or enterprise geodatabase from a specified list of feature classes, layers, datasets, or tables. Optionally, you can use a filter geometry from another feature layer to replicate features within an area of interest.
Usage
All datasets must be from the same enterprise geodatabase.
This tool is similar to the Create Replica tool in the Data Management toolbox. This tool allows you to use a selected feature in another feature layer as an area of interest for replicated features. Any features from Replica Datasets with the USE_FILTERS option that intersect or are contained by the selected feature in Filter Feature Layer will be replicated to the Child Workspace.
Data replicated with the ONE_WAY and TWO_WAY options must have a populated Global ID type field. Use the Add Global IDs tool in the Management toolbox to create and populate a global ID field in your data.
For checkout and one-way replicas, the child replica geodatabase can be an enterprise geodatabase, personal, or file geodatabase.
For one-way and two-way child–to–parent replicas, the child geodatabase must be a file 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.
Use selection sets and layer definition queries to limit or specify features to replicate. To do this in ArcCatalog, use the Make Feature Layer tool or create layer files for Replica Datasets.
Related data is replicated by default. To avoid replicating related data, you must specify each relationship class that defines the related objects you want to exclude using the Exclude Relationship Classes parameter.
Related data is replicated in a forward direction, from origin to destination.
If using Register Using Existing Data, you must make sure to add Global IDs to the data before you copy it to the other geodatabase. If you use functionality within ArcGIS to copy the data, make sure to use either copy and paste, data extraction, or XML workspace export and import.
You must be connected as the owner of the data on the target geodatabase when creating the replica.
Whatever filters are applied during the replica creation process also are applied to the data in the relative geodatabase.
The Register Using Existing Data option also works in disconnected environments.
Syntax
arcpy.production.CreateReplica(in_datasets, in_replicatype, in_childworkspace, in_replicaname, {in_reuse_schema}, {in_usefilter}, {in_filtertype}, {in_features}, {in_access_type}, {in_use_archiving}, {in_exclude_rel_classes}, {in_register_existing_only}, {in_ignore_where_clause_for_deletes}, {in_ignore_updates_outside_filter})
Parameter | Explanation | Data Type |
in_datasets | Value table of rows that contain a dataset to replicate and a filter option for that dataset. Specifying a filter option allows you to control how rows are replicated per dataset. Filter options include the following:
| Value Table |
in_replicatype | The type of replica to create:
| String |
in_childworkspace | The path to and name of the workspace that will contain the replicated data. | File; GeoDataServer; Workspace |
in_replicaname | The name of the replica you create. | String |
in_reuse_schema (Optional) | Indicates whether to reuse the schema of existing data in the in_childworkspace. This option can reduce the time required to replicate data by not re-creating existing schemas in the in_childworkspace. The in_reuse_schema is most efficient when used to replicate data into empty schemas in the in_childworkspace. This option is only available for checkout replicas.
| String |
in_usefilter (Optional) | Replicates features that either intersect or are contained by in_features. Only applied to in_datasets that have the USE_FILTERS option.
| Boolean |
in_filtertype (Optional) | Specifies the spatial relationship between in_datasets and in_features.
| String |
in_features (Optional) | Feature layer with one selected feature. | Layer |
in_access_type (Optional) | Indicates the feature information model type to replicate. Model type specifies either simple or complex features.
| String |
in_use_archiving (Optional) | 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. The in_replicatype must be created from the DEFAULT version.
| Boolean |
in_exclude_rel_classes [in_exclude_rel_classes,...] (Optional) | The list of relationship classes whose relationships you want to exclude from replication. The relationship classes will still be included if both datasets that participate are present, but the related objects are not replicated. | Relationship Class |
in_register_existing_only (Optional) | Allows the creation of replica versions needed to synchronize changes between geodatabases using existing data. This will disable the process of copying data.
| Boolean |
in_ignore_where_clause_for_deletes (Optional) |
| Boolean |
in_ignore_updates_outside_filter (Optional) |
| Boolean |
Code sample
CreateReplica example (stand–alone script)
The following stand-alone script demonstrates how to use the CreateReplica tool.
# Name: CreateReplica.py
# Description: Creates a checkout replica
# Requirements: ArcGIS Production Mapping
import arcpy
# check out a foundation license
arcpy.CheckOutExtension("Foundation")
# set gp environment
workspace="c:/data"
arcpy.env.workspace=workspace
arcpy.addOutputsToMap = True
# variables for tool parameters
filterFeatureClass = "Austin.gdb/AOI"
filterFeature = "AOI Layer"
filterWhere="MSNAME='Austin East'"
selectType="NEW_SELECTION"
checkoutDb = "checkoutDb.gdb"
# note: change the fully qualified name to your database.owner
inDatasets="austin.sde/database.owner.TopographicMap/database.owner.ElevationP USE_FILTERS"
replicaType="CHECKOUT"
replicaName="austin_elevations_contours"
reuseSchema="DO_NOT_REUSE"
useFilter="FILTER_BY_GEOMETRY"
filterType="INTERSECTS"
accessType="FULL"
useArchiving="NO_ARCHIVING"
excludeRelClass="austin.sde/database.owner.TopographicMap/database.owner.RelClass"
useExisting="DO_NOT_REGISTER_EXISTING_DATA_ONLY"
# Create an in_features feature layer
if arcpy.Exists(filterFeature) == False:
arcpy.MakeFeatureLayer_management(filterFeatureClass,filterFeature)
# select one feature from the feature layer
arcpy.SelectLayerByAttribute_management(filterFeature,selectType,filterWhere)
# make a new geodatabase for the replica gdb
if arcpy.Exists(checkoutDb) == False:
arcpy.CreateFileGDB_management(workspace,checkoutDb)
# check out some data into the new file gdb
arcpy.CreateReplica_production(inDatasets,replicaType,checkoutDb,replicaName,reuseSchema,useFilter,filterType,filterFeature,accessType,useArchiving,excludeRelClass,useExisting)
print arcpy.GetMessages()
Environments
Licensing information
- Basic: No
- Standard: Requires Production Mapping
- Advanced: Requires Production Mapping