I want to delete some tables from my SDE as well as some featureclasses located in a feature-dataset. As some of those tables and featureClasses are enabled for archiving I get both the base-table/FC and its archive in two seperate steps. However I wonder if I cannot get both in one single step?

This is the code I currently use (step 1)

result = arcpy.ListTables(user + ".KS*")       # get the tables beginning with KS
for ds in arcpy.ListDatasets(user + ".KOM_*"): # get the FDS beginning with KOM
    for fc in arcpy.ListFeatureClasses(None, None, ds):

Now I want to append all the archive-tables also (step 2):

for ds in result:
    if arcpy.Describe(ds).IsArchived: result.extend([ds])

However this loop never terminates. Obviously everytime we find an archived table we add it to the result and re-iterate the whole loop.

After all I delete all the datasets within my list using

for ds in result:

Does anyone know how I may add the archive-tables also to my list?

  • The correct terms of art would be "Delete archive-enabled feature classes from geodatabase"
    – Vince
    Nov 26, 2015 at 13:43

1 Answer 1


I found the solution and it was quite easy. The endless-loop occured because I added the same dataset again and again into the loop. I changed it to if arcpy.Describe(ds).IsArchived: result.extend([ds + "_H"]) and now it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.