I'm trying to make a SSMS (SQL Server) job step, which calls a python script to execute through powershell - but instead of using the SQL integrated Python, I want to use a Python environment that is installed on the server.
Instead of the usual command python "D:\path\script.py"
, I'm first trying to activate a Conda environment and then executing the python script like this: conda activate environment; python "D:\path\script.py"
If I run the above command in powershell on the server, with the agent account that runs the script through SSMS, it goes through successfully.
If I set the same command on the job step and run the job, I get the the same output as if I didn't activate the environment beforehand (If I just executed the script, without first activating the environment).
Is this possible or do I have to find another way to execute this script?
This is how I have my step set up:
An alternative solution I found is to create a ps1 file with the text conda activate environment; "D:\path\script.py"
, and then call the ps1 file in the job step.
This works but I'd like to execute it directly through a job step if possible.