This question is based off of another one I just had.
I can't seem to update a feature dataset in a sql server enterprise geodatabase. I have sysadmin user role access to the database. One thing I've tried is copying the path of the connection file from an ArcPro project and using that in the script. This particular script here works perfect if I use it on a file geodatabase inside a folder. Basically, I'm not sure how to connect to the enterprise geodatabase.
update the feature classes in the feature dataset gisedit.DBO.dFIRM_2019_Effective
from the shapefiles in this directory:
from arcpy import env
shp = r'\\gisfile\GISsources\Federal\FEMA\DFIRM\
#sde connection file variable
sde = r'C:\Users\jpilbeam\AppData\Local\Temp\ArcGISProTemp11396\
env.workspace = shp
#populate the fcList
fcList = arcpy.ListFeatureClasses()
env.workspace = sde
env.overwriteOutput = True
#iterate list of shapefiles and copy to sde feature dataset
for shapefile in fcList:
in_shapefile = os.path.join(shp, shapefile)
out_featureclass = os.path.splitext(shapefile)
print('Copying %s to %s' %(in_shapefile, out_featureclass))
Traceback (most recent call last):
File "\\gisfile\GISstaff\Jared\Python Scripts\ArcGISPro\dFIRM.py", line 30, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2948, in CopyFeatures
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2945, in CopyFeatures
retval = convertArcObjectToPythonObject(gp.CopyFeatures_management(*gp_fixargs((in_features, out_feature_class, config_keyword, spatial_grid_1, spatial_grid_2, spatial_grid_3), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 506, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000733: Output Feature Class: Same as input Input Features
Failed to execute (CopyFeatures).
I forgot to mention that the shapefiles and the features in the dataset have the same names. I need to update the dataset every month with these shapefiles.