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()
arcpy.env = SDEConnection desc = arcpy.Describe(SDEConnection) domains = desc.Domains for domain in domains: print domain
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
if desc.domains: print 'There be domains ahead...' else: print 'No domains here!'
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.