arcpy.env = SDEConnection desc = arcpy.describe(SDEConnection) domains = desc.Domains for domain in domains: print domain
if desc.domains: print 'There be domains ahead...' else: print 'No domains here!'
import arcpy workspace = env.workspace = r"Z:\Test.gdb" desc = arcpy.Describe(workspace) domains = desc.domains for domain in domains: if arcpy.Exists(domain): print domain
if arcpy.Exists(domain): print domain
if not arcpy.Exists(domain): print domain
arcpy.env = SDEConnection desc = arcpy.Describe(SDEConnection) domains = desc.Domains for domain in domains: print domain
import pyodbc cnxn = pyodbc.connect('Driver={SQL Server Native Client 10.0};UID=<username>;PWD=<password>;SERVER=<server name>;DATABASE=<database>;') cursor=cnxn.cursor() cursor.execute("SELECT items.Name AS 'Domain Name', items.Definition.value('(/*/Owner)[1]','nvarchar(max)') \ AS 'Owner' FROM sde.GDB_ITEMS AS items INNER JOIN sde.GDB_ITEMTYPES AS itemtypes ON \ items.Type = itemtypes.UUID WHERE itemtypes.Name IN ('Coded Value Domain', 'Range Domain')") rows = cursor.fetchall() for row in rows: print row[0] cursor.close() cnxn.close()
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.