Set Subtype Field Spinning

108
1
Jump to solution
06-20-2019 04:17 PM
forestknutsen1
MVP Regular Contributor

I am trying to remove subtypes from a number of tables with python. I tested things on fgdb copy of the sde data. Everything worked fine. However, when I run it in our sde dev environment it makes it past the first two tables then just hangs.....

I have also tried it with the ArcCatolog tool on the problem table. It has been running for 25 minutes. 

arcpy.SetSubtypeField_management(table, clear_value='TRUE')

The tables have a large number of subtypes. Some tables have over 260! (someone did not understand how to use subtypes...)

I did remove sde locks before trying to remove them.

Has anyone ever run across this problem?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
forestknutsen1
MVP Regular Contributor

I ended up removing each subtype independently with its subtype code. This worked...

import arcpy
import arcgisscripting

connection = xxxxxx

arcpy.env.workspace = connection
tables = ["T_StructureAsset",
          "T_MiscellaneousAsset",
          "T_FoundationAsset",
          "T_GuyAsset",
          "T_AnchorAsset", ]

for table in tables:
    print '\n' + '*' * 40
    print 'Remove subtypes for ' + table
    subtypes = arcpy.da.ListSubtypes(table)
    for k, v in subtypes.items():
        print 'Removing subtype code: ' + str(k)
        try:
            arcpy.RemoveSubtype_management(table, k)
        except arcgisscripting.ExecuteError:
            print '\n' + arcpy.GetMessages() + '\n'

View solution in original post

0 Kudos
1 Reply
forestknutsen1
MVP Regular Contributor

I ended up removing each subtype independently with its subtype code. This worked...

import arcpy
import arcgisscripting

connection = xxxxxx

arcpy.env.workspace = connection
tables = ["T_StructureAsset",
          "T_MiscellaneousAsset",
          "T_FoundationAsset",
          "T_GuyAsset",
          "T_AnchorAsset", ]

for table in tables:
    print '\n' + '*' * 40
    print 'Remove subtypes for ' + table
    subtypes = arcpy.da.ListSubtypes(table)
    for k, v in subtypes.items():
        print 'Removing subtype code: ' + str(k)
        try:
            arcpy.RemoveSubtype_management(table, k)
        except arcgisscripting.ExecuteError:
            print '\n' + arcpy.GetMessages() + '\n'

0 Kudos