Need to list alll domains in a GeoDatabase (ArcGIS 10)

12-01-2011 12:46 PM
Regular Contributor
Is there a geoprocessing tool that will bring back a list of domains within a geodatabase? 

I'd then like to loop through a list of all the domain values.  Then I can programmatically export all domains to tables both for documentation purpose of documenting and also as a means of comparing the same domain from two different geodatabases.
Tags (2)
4 Replies
Esri Contributor
There isn't an actual tool; however, python can access the workspace properties in order to examine the domains associated with that workspace. Check out this link on the workspace properties. The domain property will automatically make a list object and you can use a For loop to sort through those and do whatever you need to do to the domains, such as running each domain through the Domain to Table tool.

I hope that helps!
Occasional Contributor II

This code works.It will create a table in an SDE database - recreating it each time. Lists all the domains used in the workspace.

import arcpy
inWorkspaceString = arcpy.GetParameterAsText(0)
arcpy.env.workspace = inWorkspaceString
outTable = "OTHER_ListDomains_tbl"

# Delete old and Create new output table each time
if arcpy.Exists(outTable):
arcpy.CreateTable_management(inWorkspaceString, outTable)
arcpy.AddField_management(outTable, "DomainName", "TEXT", "", "", 255, "", "NULLABLE", "REQUIRED")
arcpy.AddField_management(outTable, "Versioned", "TEXT", "", "", 1, "", "NULLABLE", "NON_REQUIRED")
newRows = arcpy.InsertCursor(outTable, "") # Create cursor to store new rows for output table
arcpy.MakeTableView_management(outTable, "outTableView", "", "", "") # Create table view for output table (for searching for existing records)
# Create list of domains
desc = arcpy.Describe(inWorkspaceString)
domains =
domains.sort() # Sorts list
for domain in domains:
# Write items from list to output table if they don't already exist there
   arcpy.SelectLayerByAttribute_management("outTableView", "NEW_SELECTION", "\"DomainName\" = \'" + domain + "\'")
   if int(arcpy.GetCount_management("outTableView").getOutput(0)) == 0:
      newRow = newRows.newRow()
      newRow.DomainName = domain
del newRows # Removes lock on output table

MVP Regular Contributor

Since this discussion was created in 2011, ListDomains—Help | ArcGIS Desktop is probably the best way to get this information in 2017 using Python.

New Contributor III

I realize this is a very old thread, but I can't recommend enough X-ray for ArcCatalog for exactly this.