Saturday 5 January 2019

How to determine storage type (ST_Geom/Oracle) from arcpy/python


We're migrating some feature classes from SDELOB (or some older binary format) to ST_Geometry. As we write our arcpy script to use the ESRI Migrate Storage Tool we'd like to test whether or not something already is ST_Geom...Other than writing hooks into the database, using the comtypes package etc., does anyone know of a simple way to determine this?



Answer



To follow-up on PolyGeo's answer, the Describe object is certainly where it should be, but it isn't. Database queries may be the best way to go here.


Although, if you have the SDE command-line binaries, another option would be to try doing something like this (yes it's a hack, but might work):


import subprocess

output = subprocess.check_output("sdelayer -o describe_long -s servername -D dbname -u username -p password -l tablename,columname")
for line in output:
if line.find("Layer Type") == 0:
storagetype = line.partition(":")[2].strip() # Should be something like "SDE-BINARY" or "Extended SQL Type/ST_GEOMETRY"

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...