When using ArcPy with the ArcGIS Desktop (10.4.1) architecture I am able to set a variable to a feature class and make a feature layer from it using the code below:

rock_unit_table = "Database Connections\\TEST PROD [personal].sde\\Test.TEST.DETAILED_SURFACE_COMP"
arcpy.MakeFeatureLayer_management(rock_unit_table, "rockUnit_lyr")

but when I try to do something analogous using ArcPy with ArcGIS Pro 1.3.1:

rock_unit_table = r"Databases\TEST PROD [personal]\Test.TEST.DETAILED_SURFACE_COMP"
arcpy.MakeFeatureLayer_management(rock_unit_table, "rockUnit_lyr")

I get an error (with some anonymizing applied):

Traceback (most recent call last): File "N:\path\Test.py", line 324, in arcpy.MakeFeatureLayer_management(rock_unit_table, "rockUnit_lyr") File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5607, in MakeFeatureLayer raise e File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5604, in MakeFeatureLayer retval = convertArcObjectToPythonObject(gp.MakeFeatureLayer_management(*gp_fixargs((in_features, out_layer, where_clause, workspace, field_info), True))) File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing_base.py", line 506, in return lambda *args: val(*gp_fixargs(args, True)) arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Features: Dataset Databases\TEST PROD [personal]\Test.TEST.DETAILED_SURFACE_COMP does not exist or is not supported Failed to execute (MakeFeatureLayer).

In ArcGIS Pro I can see the feature class under Databases in the Project pane so I think it is my syntax in ArcPy that is astray.

Can anybody suggest what may be astray with the syntax that I am trying to use?

2 Answers 2


It seems as you cannot use this shortcut any longer. When the Database Connections special folder is dragged into the Python window in ArcMap, you get:


This is because there is only one Database Connections per user, that is it is a universal source of all your enterprise database connections.

However, in ArcGIS Pro, Databases is specific to a project, that is every project will have its own Databases shortcut. When you drag the Databases into the Python window, you get:


There is no data path to the actual folder where the .sde files are stored. Thus, you won't be able to supply the Databases shortcut when running your arcpy scripts targeting ArcGIS Pro.

Trying to supply:

r"GDB\db.sde\esrigdb.DBO.DataLines" or r"Databases\db.sde\esrigdb.DBO.DataLines" just won't work.

Since you are always working with a specific ArcGIS Pro project, I'd get its homeFolder and then use os.path.join to get the database path:

proj = mp.ArcGISProject(r"C:\Users\%username%\Documents\ArcGIS\Projects\MyProject\MyProject.aprx")

The .sde connection files are stored in the project homeFolder.

  • In my case the *.sde file is not located in the homeFolder but your answer enabled me to piece together what I needed to do. I'll post an answer describing that.
    – PolyGeo
    Apr 10, 2017 at 22:33

I was able to solve this using the answer from @AlexTereshenkov to arrive at this workflow.

  1. In the Project pane of ArcGIS Pro 1.3.1 I right-clicked on the enterprise database connection under Databases to open its Properties
  2. I copied its Name e.g. N:\path\SDEfiles\TEST PROD [personal].sde (SDEfiles is simply a folder that I created to place *.sde files into)
  3. Ran this test which printed Polygon and worked without error:

import arcpy
rock_unit_table = r"N:\path\SDEfiles\TEST PROD [personal].sde\Test.TEST.DETAILED_SURFACE_COMP"
arcpy.MakeFeatureLayer_management(rock_unit_table, "rockUnit_lyr")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.