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.
<SPAN class="string token">"""
update the feature classes in the feature dataset gisedit.DBO.dFIRM_2019_Effective
from the shapefiles in this directory:
\\gisfile\GISsources\Federal\FEMA\DFIRM\EffectiveProducts\SHP\17197C_WillCo_FIRMdb
"""</SPAN>
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
<SPAN class="keyword token">import</SPAN> os
<SPAN class="comment token">#shapefile variable</SPAN>
shp <SPAN class="operator token">=</SPAN> r'\\gisfile\GISsources\Federal\FEMA\DFIRM\
EffectiveProducts\SHP\17197C_WillCo_FIRMdb'
<SPAN class="comment token">#sde connection file variable</SPAN>
sde <SPAN class="operator token">=</SPAN> r'C<SPAN class="punctuation token">:</SPAN>\Users\jpilbeam\AppData\Local\Temp\ArcGISProTemp11396\
d532de7f<SPAN class="number token">-5c8c</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">43c9</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">94bc</SPAN><SPAN class="operator token">-</SPAN><SPAN class="number token">3cf9407b9505</SPAN>\gissql<SPAN class="punctuation token">.</SPAN>sde\dFIRM_2019_Effective'
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> shp
<SPAN class="comment token">#populate the fcList</SPAN>
fcList <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFeatureClasses<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> sde
env<SPAN class="punctuation token">.</SPAN>overwriteOutput <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN>
<SPAN class="comment token">#iterate list of shapefiles and copy to sde feature dataset</SPAN>
<SPAN class="keyword token">for</SPAN> shapefile <SPAN class="keyword token">in</SPAN> fcList<SPAN class="punctuation token">:</SPAN>
in_shapefile <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>shp<SPAN class="punctuation token">,</SPAN> shapefile<SPAN class="punctuation token">)</SPAN>
out_featureclass <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>splitext<SPAN class="punctuation token">(</SPAN>shapefile<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">'Copying %s to %s'</SPAN> <SPAN class="operator token">%</SPAN><SPAN class="punctuation token">(</SPAN>in_shapefile<SPAN class="punctuation token">,</SPAN> out_featureclass<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN>
arcpy<SPAN class="punctuation token">.</SPAN>CopyFeatures_management<SPAN class="punctuation token">(</SPAN>in_shapefile<SPAN class="punctuation token">,</SPAN> out_featureclass<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">##</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"done"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>Error:
Traceback (most recent call last):
File "\\gisfile\GISstaff\Jared\Python Scripts\ArcGISPro\dFIRM.py", line 30, in <module>
arcpy.CopyFeatures_management(in_shapefile, out_featureclass)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 2948, in CopyFeatures
raise e
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).
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>EDIT:
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.