mbly29

Conecting to SDE and ODBC

Discussion created by mbly29 on Aug 31, 2012
Latest reply on Aug 19, 2014 by emelinerenz
Here is a script that I am running to attempt to copy FD from an SDE to a FGDB on another server. I have ran this script with tests FGDB setup on a single server and it works. Now when I attempt to run the script, nothing happens, no errors, nothing. I get an exit code of 0, when I hit run it returns the 0 code in probably a half a second. So nothing has ran.

Do I need to setup a new path in the ODBC in order for this code to be able to find the connection to the SDE? And if so, how do I set this up properly?

Here is the code:

# Import system modules
import arcpy
from arcpy import env
import os, sys, traceback

# Set environment settings
arcpy.env.workspace = "Database Connections\\COL_LCT_SDE.sde"
dir
##arcpy.env.overwriteOutput = True

# Set local variables
outpath = r"G:\\PythonTest.gdb"
##outpath = r"I:\\ROBOTEST.gdb"
##pre = 'COL_LCT_SDE.'

# Copy feature datasets to new FGDB
try:
    fdList = arcpy.ListDatasets("*","Feature")
    copy1 = 'ManagedData'
    copy2 = 'PublicWorks'
    copy3 = 'Annotation'
    copy4 = 'TCA'
    copy5 = 'ReferenceData'

    for fd in fdList:
        pastefd = outpath + os.sep + str(fd)

        if fd == copy1:
            arcpy.Copy_management(fd, pastefd)

        if fd == copy2:
            arcpy.Copy_management(fd, pastefd)

        if fd == copy3:
            arcpy.Copy_management(fd, pastefd)

        if fd == copy4:
            arcpy.Copy_management(fd, pastefd)

        if fd == copy5:
            arcpy.Copy_management(fd, pastefd)

except:
    arcpy.AddError(arcpy.GetMessages(2))
                  
   
del fdList

Thanks,

Mike

Outcomes