Select to view content in your preferred language

Is there a way to see what domains are in use in SDE?

595
2
Jump to solution
07-20-2012 07:51 AM
TimShields
Deactivated User
Hi all,

I have inherited some SDE databases that have multiples of the same domain like domain_1, domain_2, domain_3, etc. I was wondering if there was a way to see what feature classes are using the domains so I can update the feature classes to be using the same domain instead of having multiples of the same domain.

Thanks in advance
0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor
Hi Tim,

You could accomplish this using Python.  Here is an example:

import arcpy from arcpy import env env.workspace = r"C:\temp\python\Test.sde"  lstDatasets = arcpy.ListDatasets("*") for dataset in lstDatasets:     lstFCs = arcpy.ListFeatureClasses("*", "", dataset)     for fc in lstFCs:         lstFields = arcpy.ListFields(fc)         for field in lstFields:             if field.domain:                 print fc, field.name, field.domain


What this code does is loop through all feature classes in the 'Test' SDE geodatabase and, if a domain is present, prints out the feature class name, the field name that contains the domain, and the domain name.

View solution in original post

0 Kudos
2 Replies
JakeSkinner
Esri Esteemed Contributor
Hi Tim,

You could accomplish this using Python.  Here is an example:

import arcpy from arcpy import env env.workspace = r"C:\temp\python\Test.sde"  lstDatasets = arcpy.ListDatasets("*") for dataset in lstDatasets:     lstFCs = arcpy.ListFeatureClasses("*", "", dataset)     for fc in lstFCs:         lstFields = arcpy.ListFields(fc)         for field in lstFields:             if field.domain:                 print fc, field.name, field.domain


What this code does is loop through all feature classes in the 'Test' SDE geodatabase and, if a domain is present, prints out the feature class name, the field name that contains the domain, and the domain name.
0 Kudos
TimShields
Deactivated User
Thank you for the quick response. This was exactly what I was looking for.

Thanks again!
0 Kudos