I'm trying to copy some feature layers from an SQL server to a file geodatabase on my C drive. The problem I'm running into is when there are some of the feature layers within a dataset on the server and I try to copy the file(s) to a dataset folder on the file geodatabase. I does working work when there are no dataset folders.
It seems like the "arcpy.management.CopyFeatures()" function doesn't like working with datasets. I keep getting the following error message:
ERROR 000354: The name contains invalid characters
Failed to execute (CopyFeatures).
Is there a different function for datasets?
Thanks,
can you provide the input and output paths?
000354: The name contains invalid characters.—ArcGIS Pro | Documentation
databases etc may have their own acceptable limits regarding names
import arcpy, os, sys
arcpy.env.workspace = r"Database Connections\Server - sdeVector.sde\sdeVector.SDEDATAOWNER.Administrative"
arcpy.management.CopyFeatures("sdeVector.SDEDATAOWNER.MunicipalArea", r"C:\Datafiles\GISPro_GeoDatabase\Local_Basemap.gdb\MunicipalArea")
print("Done")
"Administrative" is the subfolder or dataset on the server, and I created a dataset on the file geodatabase with the same name.
There are several tools available for moving data around, maybe give Export Features (Conversion)—ArcGIS Pro | Documentation a try.
Tried the export function, but it didn't work. Keeps giving me an error message about the folder(or file?) already existing. But it's not there when I click refresh in ArcCatalog.
ERROR 000725: Output Feature Class: Dataset C:\Datafiles\GISPro_GeoDatabase\Local_Basemap.gdb\Administrative already exists.
Failed to execute (ExportFeatures).
Sorry for the delay with an update, I was able to get the datasets updated. What I did was delete the old dataset folders and their contents, then re-create the empty dataset folders. And finally use the arcpy.management.CopyFeatures function for each feature layer in each dataset. It does take a long to run this update, but it does work so i will live with it.
Thanks for all the suggestions!