0

I thought I could use the arcpy.env.overwriteOutput = True to overwrite the existing datasets within my target SDE "JeffCoGIS.sde"; however, I get an error that states:

ExecuteError: ERROR 000260: Failed to copy Database Connections\GISData.sde\GISData.DBO.GIS_Dept into Database Connections\JeffCoGIS.sde\GISData.DBO.GIS_Dept ERROR 000260: Item with the same path name already exists. Failed to execute (Copy).

I am new to python and couldn't find any help in ESRI Resources on how to overwrite the datasets. Some have mentioned to use replication; however, for our particular workflow, we need to pursue overwrite and copy, if I can get it to work.

Is there a different tool I should use?

If I run this script on the empty SDE, it works fine - just when trying to overwrite the existing datasets.

#Name:  Copy_JeffCoGIS_Rev2.py
#Copy all datasets including the feature classes within each dataset from
#    SDE database "GISData.sde" to SDE database "JeffCoGIS.sde"
import arcpy
arcpy.env.overwriteOutput = True
arcpy.env.workspace = "Database Connections\\GISData.sde"

fcList = arcpy.ListDatasets()
#print fcList

for dataset in fcList:
    arcpy.Copy_management(dataset, "Database Connections\\JeffCoGIS.sde\\"+ 
    dataset)
  • Does this answer help? gis.stackexchange.com/a/158773/43 – Richard Morgan Jun 28 '18 at 19:03
  • It is not working for all datasets; however, I did look up that link as well, but am not sure where the appropriate place in my script is to place it since I am working with a list (multiple datasets). – Sandy Jun 28 '18 at 19:16
  • You would put inside your loop - if arcpy.Exists (dataset): arcpy.Delete_management (dataset) – user2856 Jun 28 '18 at 21:37
1

When copying try:

arcpy.Copy_management(dataset, "Database Connections\\JeffCoGIS.sde\\" + dataset.split(".")[1])

Not the answer you're looking for? Browse other questions tagged or ask your own question.