In ArcGIS a feature_class name MUST be unique within a GDB. ie:
if Dataset_AA contains Feature_Class_AA then Feature_Class_AA cannot exist anywhere else in the same GDB regardless of whether it is in a Dataset or not.
take this schema for example:
in this map:
and this script:
arcpy.env.overwriteOutput = True
feature_class = r'C:\P2P\DMP_GeoDB_EXP.mdb\thisdoesntexist\Boundaries'
with arcpy.da.UpdateCursor(feature_class, ["PermitNo", "AppType", "FeatCLS",
"Contact", "National_ID", "Source","Type_Flag", "Calc"]) as cursor:
for row in cursor:
One would expect this not to run for a feature class in the root of the GDB (as Boundaries is), and they'd be right due to the invalid Dataset specified. The same is true even for a featue class that IS in a dataset (as Boundaries_AA is). Changing feature_class to:
feature_class = r'C:\P2P\DMP_GeoDB_EXP.mdb\thisdoesntexist\Boundaries_AA'
Fails to execute as well.
If the argument to UpdateCursor has Either an Invalid Dataset Or Invalid FeatureClass, the script will fail.
Here's where things get weird:
If BOTH the Dataset and FeatureClass exist, arcpy will successfully delete the features from the feature class EVEN if the feature class is NOT in the Dataset!
If we change feature_class to:
feature_class = r'C:\P2P\DMP_GeoDB_EXP.mdb\Dataset_AA\Boundaries_BB'
Notice that Boundaries_BB is NOT in Dataset_AA. The results are painfull:
As you can see, Boundaries_BB(the feature class) was deleted even though it was NOT in Dataset_AA.
consider these scenarios for feature_class:
feature_class = r'C:\P2P\DMP_GeoDB_EXP.mdb\Dataset_AA\Boundaries'
feature_class = r'C:\P2P\DMP_GeoDB_EXP.mdb\Boundaries_AA'
and a more troubling result:
Not once did we pass UpdateCursor a fully qualified path name to our feature_classes ... and yet, all of our data is deleted.
If you're brave enough, I uploaded the Map, Scripts, & DB to dropbox.
These results may be unique to Personal GeoDatabases. File Geodatabases may not exhibit this exact behavior.