Sample Replication ArcPy Script

Blog Post created by pmckinneyccpa on May 19, 2016

Over the past month, I've been busy enhancing several python scripts I've developed to automate GIS data updates for Cumberland County.  These scripts run replications, rebuild address locators, and rebuild map caches.

The enhancements have included adding log files to help us track whether the scripts run successfully or not.  This is important because the scripts are run as automated tasks during off-hours.  I thought it would be a good idea to share these scripts with the wider GIS community.

The first of these is for running the Synchronize Changes tool for geodatabases participating in replication.   This allows us to push edits we make to layers such as road centerlines and address points to various departments in our organization.

The sample script is intended to push the changes from a parent SDE geodatabase to a child file geodatabase.  You will need to update the following properties in the script to use it with your organization:

  1. file path to the log file which will be created (a new file is created each time the script is run)
  2. the SDE connection to the parent database
  3. the file path to the child file geodatabase
  4. the name of the replication

You can find the sample script on GitHub.

--- Patrick McKinney

Photo credit: Eric Bailey