Guest User

Untitled

a guest
Aug 14th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. inGDB = r"D:mygeodatabase.gdb"
  2. env.workspace = inGDB
  3. #################Getting all Tables and Feature Classes###########
  4. fcs = []
  5. #root of workspace
  6. for item in arcpy.ListFeatureClasses("*"): fcs.append(item)
  7. for item in arcpy.ListTables("*"): fcs.append(item)
  8.  
  9. fds = arcpy.ListDatasets("*","Feature")
  10. for fd in fds:
  11. env.workspace = inGDB +'\'+fd
  12. for fc in arcpy.ListFeatureClasses("*"):
  13. fcs.append(fd+'/'+fc)
  14. for tb in arcpy.ListTables("*"):
  15. fcs.append(fd+'/'+tb)
  16.  
  17. env.workspace = inGDB
  18. relClasses = set()
  19. for i,fc in enumerate(fcs):
  20. desc = arcpy.Describe(fc)
  21. for j,rel in enumerate(desc.relationshipClassNames):
  22. relDesc = arcpy.Describe(rel)
  23. if relDesc.isAttachmentRelationship:
  24. continue
  25. relClasses.add(rel)
  26.  
  27. print relClasses
  28.  
  29. arcpy.env.workspace = 'C:/workspace'
  30.  
  31. # Local variables
  32. tables = arcpy.ListTables()
  33.  
  34. # Iterate through tables in file geodatabase (workspace)
  35. for t in tables:
  36. # Get relationship class(es) associated with table
  37. desc = arcpy.Describe(t)
  38. rcs = desc.relationshipClassNames
  39. # Iterate through any relationship classes associated with current table in loop
  40. for r in rcs:
  41. if len(r) > 30:
  42. print 'Relationship class ' + r + ' has ' + str(len(r)) + ' characters.'
  43.  
  44. layer = "C:\Geodatabases\somegeodatabase.gdb\my_layer"
  45. desc = arcpy.Describe(layer)
  46. print desc.relationshipClassNames
Add Comment
Please, Sign In to add comment