Provide ability to run the Python using PowerShell

Hi All, needs some suggestions please.

here is my request - I have a python script which connects to sql db and exports the output as csv. Python script has user credentials which are used for connectivity. I want to provide the ability to run the python script to other colleagues by wrapping/calling that via power shell without disclosing any kind of code/user credentials in the python script.

Can we achieve this using powershell? please suggest. TIA.

Yes, PowerShell works just as a shell too.

Just use python.exe yourscript.py inside the PowerShell script.

While this can be achieved fairly simply just calling the python executable my first question would by, why would you want to? Typically, best practice is to avoid mixing languages whenever possible. Since everything you state you’re doing can be done relatively easily in PowerShell, why not skip the middle man?

thank you @kvprasoon and @jlogan3o13 .

agree with @jlogan3o13. however, I need to use some libraries that comes with python to export the data into csv. at the same time, I do want to provide the ability for other users to run the python script without giving them privileges on database and with a single click or something along those lines they should get the same csv output.

Thank you!