0

I'm trying to call .py file in SQL ML Services and put it into the @script variable. This issue differs from 'Call Python file from within SQL Server' question as I do not want it to be put into SQL job.

I need sth like:

EXEC sp_execute_external_script @language = N'Python', 
  @script = (read from python file .py)

The point is NOT to use any python code in the SQL scripts and reference it to the .py file for maintainability purposes.

Masoud
  • 1
  • 3
  • *"I do not want it to be put into SQL job"* you don't have to. What is the problem here? What do you mean you need "sth"? What is "sth"? Have you had a read of the documentation? [Quickstart: Run simple Python scripts with SQL machine learning](https://learn.microsoft.com/en-us/sql/machine-learning/tutorials/quickstart-python-create-script?view=sql-server-ver15) – Thom A Oct 06 '21 at 07:49
  • Yes, I have read it. I need to set script parameter to an external python .py file like @script = refer to script.py – Masoud Oct 06 '21 at 08:34
  • Use `OPENROWSET` to read the file and store it into a variable. – Thom A Oct 06 '21 at 09:18
  • Thanks @Larnu It worked! – Masoud Oct 08 '21 at 20:28

0 Answers0