AnsweredAssumed Answered

How can I check whether a replica exists, with python, before using arcpy.CreateReplica_management()   ?

Question asked by rastrauch Champion on Feb 21, 2017
Latest reply on Feb 21, 2017 by rastrauch

I'm working on a script/tool for a python addin that will let me create a replicas, one at a time per tool run, but to different locations.  Another script will allow me to sync the replicas.  These will be one-way replicas, from a SQL SDE to file GDBs.  Currently I am using ArcGIS Desktop 10.3.1 advanced, SDE SQL2008.

 

In theory, this will be done once for each location and I will probably include an attribute so I can control the replica name. 

 

If by chance I mess up and use the same name for a replica, I will get an (expected) error:

PYTHON ERRORS:
  File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 808, in CreateReplica
    raise e

<class 'arcgisscripting.ExecuteError'>: ERROR 000775: Replica with the same name already exists.
Failed to execute (CreateReplica).

GP ERRORS:
ERROR 000775: Replica with the same name already exists.
Failed to execute (CreateReplica).

Q1: How can I test whether the replica already exists (so I can exit cleanly with message)?  Also, I would want to use a similar test before I try to sync.

 

Q2:  Is there a way in python/arcpy to list all the replicas that currently exist?  (additional info would be nice, but not mandatory)

 

Thanks

 

tagging Geodatabase

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Outcomes