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!