工作空间属性 (arcpy)
摘要
Describe 函数可返回工作空间的以下属性。
工作空间可返回“Workspace”的 dataType。
属性
| 属性 | 说明 | 数据类型 | ||||||||
| connectionProperties (只读) | The connectionProperties is a property set. The connection properties for an enterprise geodatabase workspace will vary depending on the type of SDE database being used. Possible properties include: 
 Only one of historical_name, historical_timestamp, or version exists for any given workspace. | Object | ||||||||
| connectionString (只读) | The connection string being used in conjunction with the SDE database type. For any other workspace type, returns an empty string. | String | ||||||||
| currentRelease (只读) | For a geodatabase workspace, returns True if the geodatabase's version is current. currentRelease can be used to assess if the geodatabase can be upgraded. | Boolean | ||||||||
| domains (只读) | A Python List containing the geodatabase domain names. To work with these domain names, you can use tools from the Domains_toolset. | String | ||||||||
| release (只读) | For a geodatabase workspace, returns the geodatabase release value. Below is the mapping of geodatabase release values to ArcGIS version numbers. 
 | String | ||||||||
| workspaceFactoryProgID (只读) | The ID is a string. You can use this to distinguish between specific workspace types with a finer granularity than you can with workspaceType. For example, workspaceFactoryProgID can distinguish between a file geodatabase and a personal geodatabase. Using workspaceType, you cannot make that distinction. Following are workspaceFactoryProgID strings returned for the common workspace types: 
 | String | ||||||||
| workspaceType (只读) | The workspace type. 
 | String | 
代码实例
The following stand-alone script displays some workspace properties for an SDE database.
import arcpy
# Create a Describe object for an SDE database
#
desc = arcpy.Describe(r"C:data\Connection to state.sde")
# Print workspace properties
#
print "%-24s %s" % ("Connection String:", desc.connectionString)
print "%-24s %s" % ("WorkspaceFactoryProgID:", desc.workspaceFactoryProgID)
print "%-24s %s" % ("Workspace Type:", desc.workspaceType)
# Print Connection properties
#
cp = desc.connectionProperties
print "\nDatabase Connection Properties:"
print "%-12s %s" % ("  Server:", cp.server)
print "%-12s %s" % ("  Instance:", cp.instance)
print "%-12s %s" % ("  Database:", cp.database)
print "%-12s %s" % ("  User:", cp.user)
print "%-12s %s" % ("  Version:", cp.version)
# Print workspace domain names"
#
domains = desc.domains
print "\nDomains:"
for domain in domains:
    print "\t" + domain