2

I have a simple python script that was working fine for copying data from an SDE enterprise database connections to a FGDB.

import os,sys,arcpy
arcpy.env.overwriteOutput=True
base_layers=r'Database Connections\lucz_17_base_layers.sde'
critical_wildlife =r'Database Connections\lucz_17_critical_habitat.sde'
agriculture=r'Database Connections\lucz_17_agriculture.sde'
forest=r'Database Connections\lucz_17_forest.sde'
dbs=[base_layers,critical_wildlife,agriculture,forest]
for db in dbs:
    arcpy.env.workspace =db
    new_folder = r'R:\Data\LUCZ_2017\FileGDB_Backup'
    db_name=db.split("\\")[1].replace("lucz_17_","").replace(".sde","")
    arcpy.CreateFileGDB_management(new_folder,db_name)
    for lyr in arcpy.ListFeatureClasses():
        old_layer=os.path.join(db,lyr)
        new_db=os.path.join(new_env,db_name+".gdb")
        layer=lyr.split('.')[2]
        print "{} {} {}".format(old_layer,new_db,layer)
        arcpy.FeatureClassToFeatureClass_conversion(old_layer,new_db,layer)
        print -1

prints

Database Connections\lucz_17_base_layers.sde\lucz.sde.hl_boundary

R:\Data\LUCZ_2017\FileGDB_Backup\base_layers.gdb 

hl_boundary

and I get an error:

ExecuteError: ERROR 000210: Cannot create output R:\Data\LUCZ_2017\FileGDB_Backup\base_layers.gdb\hl_boundary
Failed to execute (FeatureClassToFeatureClass).

My inputs seem to be good for the feature class to feature class tool..not sure why the script is throwing this error. and it successfully creates the database.

it is not because the names are too long. I have used this script on many different database connections with longer layer names.

this script has been succesful in the past with just pure database connections(not enterprise real sde)

this db connection is an enterprise geodatabase..maybe that has something to do with it?

I can do a batch export from this database connection into a fileGDB with no problems...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.