Enhance Describe to enable ArcPy to determine SDE storage type (ST_GEOMETRY, etc)

414
2
06-12-2012 06:52 PM
Status: Open
Labels (3)
GraemeBrowning
Regular Contributor
From ArcPy I would like to be able to determine the storage type (ST_GEOMETRY, SDO_GEOMETRY, SDEBINARY) of data stored in relational databases via ArcSDE in order to either report on how spatial data is stored, or to determine what operations it is likely to support.

This has also been discussed at Stack Exchange GIS.
2 Comments
ChristinaKellum
I am in the process of migrating storage, I'm kinda shocked that this is not part of the Describe Object.  I am migrating 36 datasets,  some are failing in the process and then I need to go into ArcCatalog and indivdually click on each feature class to see what has been migrated.  This is kinda silly.  Please add the Geometry Storage Type to a property of the feature class.  Thanks!
IngmarAlbinson
Python example for this workaround, note placement of database connection file

# -*- coding: utf-8 -*-

import arcpy, subprocess, sys, codecs, os
reload(sys) # See stackoverflow question 2276200
sys.setdefaultencoding('utf-8')

os.chdir("C:\\Program Files\\ArcGIS\\ArcSDE\\commands\\bin")
arcpy.env.workspace = r'P:\\Database\\Connection_to_Database.sde'
password = u"Type_Your_PassWord"

desc = arcpy.Describe(arcpy.env.workspace)

# Print Connection properties

cp = desc.connectionProperties
server = cp.server
instance = cp.instance
database = cp.database
user = cp.user
version = cp.version

print "\nDatabase Connection Properties:"
print "% -12s %s" % ("  Server:", server)
print "% -12s %s" % ("  Instance:", instance)
print "% -12s %s" % ("  Database:", database)
print "% -12s %s" % ("  User:", user)
print "% -12s %s" % ("  Version:", version)
print

# Get a list of data sets and feature class
datasetList = arcpy.ListDatasets()
datasetList.sort()
datasetList.append("")

for dataset in datasetList:
    print(dataset.encode('cp1252'))

    fcList = arcpy.ListFeatureClasses("*", "All", dataset)
    fcList.sort()

    # Loop through the list
    for fc in fcList:
        if dataset == "":
            print(" "),
        else:
            print('   '),
        print(fc.encode('cp1252')),

        sdelayer = u"sdelayer -o describe_long -l " + fc + ",shape -D " + database + " -i " + instance + " -u " + user + " -p " + password
        output = subprocess.check_output(sdelayer.encode('cp1252'))
        Layer_Type = output.partition("Layer Type")[2].strip()
        Layer_Type = Layer_Type.partition(":")[2].strip()
        Layer_Type = Layer_Type.partition("Creation Date")[0].strip()
        print(Layer_Type)

print('\nPress Enter to continue ...')
raw_input()