I'm trying to export data from an SDE database to FGDB using arcpy, however the feature datasets and featureclasses have dots in the names such as 'CorporateGIS.AMFP.GeotechDraCRB2013_14' which is giving errors when I try to use them for the new feature data sets:
ERROR 999999: Error executing function. The table name is invalid
I need to be able to restore the data back to SDE so would like to use the names as is if possible - rather than replacing with something like underscores.
Here's a sample of what I'm doing in code
import arcpy, os, sys arcpy.env.workspace = "D:\Conns\CorporateGIS.sde" outFolderPath = r"H:\GIS_Export" outName = "CorporateGIS_cpy.gdb" GDB_path = os.path.join(outFolderPath, outName) datasetList = arcpy.ListDatasets("*", "Feature") for fd in datasetList: arcpy.CreateFeatureDataset_management(GDB_path, fd)
How do I keep the names as ther are with the dots?
Hello,
dots/periods are not support as feature class names. Letters, numbers and underscores are supported: https://desktop.arcgis.com/en/arcmap/latest/manage-data/geodatabases/defining-feature-class-properti...
Since your source is an SDE geodatabase, I suspect the "CorporateGIS.AMFP." portion is database instance and owner? You would either need to replace those dots with something else, or save that feature class as just "GeotechDraCRB2013_14" and maybe put the fully qualified name in the alias. If you are going to use this FGDB to restore the data back to SDE at some point, that first portion will be recreated as you see it now, if the data is loaded back to the same instance and with the same owner account name (as configured in the .sde connection file that you use).
Hey Robert
what if you try this. That should give you a "clean" name for your FGDB
for fd in datasetList:
print(fd)
fdSplit = fd.split('.')
print(fdSplit[2])
arcpy.CreateFeatureDataset_management(outFolderPath, fdSplit[2])