Esri Technical Support has an article with respect to running python scripts using the 'relative' path that contains the ArcCatalog connection name (i.e 'Database Connections/MyDatabaseName.sde/), outside of an ArcGIS Environment.
For example, running from Windows Command Prompt, or Task Scheduler.
FAQ: Why am I getting "Error 000732, < dataset name > does not exist or is not supported", in a script run outside the ArcGIS environment?
as long as you specify the python installation that comes with the ArcGIS install
(C:\Python27\ArcGIS10.4\python.exe python), and
also the the sde connection file is stored in the 'Database Connections/MyDatabaseName.sde/ directory (aka the user profile in which the process will be run: C:\Users\<userName>\AppData\Roaming\Esri\Desktop10.4\ArcCatalog), the script will run.
This is because that python install is technically part of the ArcGIS Environment.
Recently, I developed a problem in my ArcGIS Pro 2.6 clone environment and had to re-clone. I then added Spyder 4.1.3 with conda to that env and was getting a strange error when using the Run button (green arrow) to run a script:
TypeError: handle_get_file_code() got an unexpected keyword argument 'save_all'
A quick google search presented a solution of :
conda install spyder=4.1.5
Which ironically I had already tried but anaconda choked telling me that it couldn't find the package in all the searched channels.
Bottom line, if you get that error, upgrade. If the upgrade chokes, try it again later....