Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inGDB = r"D:mygeodatabase.gdb"
- env.workspace = inGDB
- #################Getting all Tables and Feature Classes###########
- fcs = []
- #root of workspace
- for item in arcpy.ListFeatureClasses("*"): fcs.append(item)
- for item in arcpy.ListTables("*"): fcs.append(item)
- fds = arcpy.ListDatasets("*","Feature")
- for fd in fds:
- env.workspace = inGDB +'\'+fd
- for fc in arcpy.ListFeatureClasses("*"):
- fcs.append(fd+'/'+fc)
- for tb in arcpy.ListTables("*"):
- fcs.append(fd+'/'+tb)
- env.workspace = inGDB
- relClasses = set()
- for i,fc in enumerate(fcs):
- desc = arcpy.Describe(fc)
- for j,rel in enumerate(desc.relationshipClassNames):
- relDesc = arcpy.Describe(rel)
- if relDesc.isAttachmentRelationship:
- continue
- relClasses.add(rel)
- print relClasses
- arcpy.env.workspace = 'C:/workspace'
- # Local variables
- tables = arcpy.ListTables()
- # Iterate through tables in file geodatabase (workspace)
- for t in tables:
- # Get relationship class(es) associated with table
- desc = arcpy.Describe(t)
- rcs = desc.relationshipClassNames
- # Iterate through any relationship classes associated with current table in loop
- for r in rcs:
- if len(r) > 30:
- print 'Relationship class ' + r + ' has ' + str(len(r)) + ' characters.'
- layer = "C:\Geodatabases\somegeodatabase.gdb\my_layer"
- desc = arcpy.Describe(layer)
- print desc.relationshipClassNames
Add Comment
Please, Sign In to add comment