In ArcMap Desktop, I have this code to find the geodatabase/sde of a layer in my map:
abPoly = 'wGISProd.WUD.Asbuilt_Polygons'
desc = arcpy.Describe(abPoly)
workspace = os.path.dirname(desc.catalogPath)
sde = arcpy.Describe(workspace)
if hasattr(sde, "datasetType") and sde.datasetType == 'FeatureDataset':
workspace = os.path.dirname(workspace)
print(workspace)
W:\\GIS\\Database Connections\\GISdb_wGISProd.OSA.sde
However, in ArcGIS Pro, I use the same code but get different results:
abPoly = 'wGISProd.WUD.Asbuilt_Polygons'
desc = arcpy.Describe(abPoly)
workspace = os.path.dirname(desc.catalogPath)
sde = arcpy.Describe(workspace)
if hasattr(sde, "datasetType") and sde.datasetType == 'FeatureDataset':
workspace = os.path.dirname(workspace)
print(workspace)
C:\Users\emyers\AppData\Local\Temp\ArcGISProTemp18060\452cb8e506fc2ab239912c037c1cb7fb.sde
How do I get the result in Desktop into Pro?
Thanks!
I use Describe catalogPath and I'm able to build a path to a different feature class in that workspace. What isn't working?
Thanks for the reply. I do not want the strange temp directory that ArcGIS Pro provides for a feature layer, I want the actual source where the data is referenced. The main point is the script is not giving me the 'catalogPath' like it describes, I am not storing my features in a temp folder.
I can't find the documentation, but I recall that ArcGIS Pro does not store the raw path to SDE connections like ArcMap did. The "strange temp directory" is the best you're going to get.