In a geoprocessing model or script tool in a toolbox, users can refer to SDE data sources by a 'relative' path that contains the ArcCatalog connection name, such as:
The reference to 'Database Connections' is understood by ArcMap and ArcCatalog, but not by Windows. If a user runs a script having this type of connection string from a command line, scheduled task, Python development product, or other non-Esri environment, it is necessary to use the full Windows path to the connection file (.sde) on disk. A valid full path might look like this:
'C:/Users/<myusername>/AppData/Roaming/ESRI/Desktop10.3/ArcCatalog/Connection to mydb.sde'
By default, a connection file created in ArcCatalog is saved to the Windows user profile, but users can copy this file anywhere and reference it in any desired location. The Windows user profile is typically located in:
'C:/Users/<myusername>'The full path to the .sde connection file can be found in the ArcCatalog Catalog Tree: Database Connections folder. Right-click the database connection, Properties > General tab. The Name field shows the full connection string.