0

Does SQL server 2012 support to call external python script ?

2
  • I believe you can use SQLCMD to call programs from SQL Server. However, reading data from Python scripts into SQL Server, I don't think it's possible in SQL Server 2012 (if you intend to do that). Commented Sep 17, 2019 at 7:46
  • That linked question, above, is really a duplicate of Run Python Script from MSSQL; as the answer just links to a different question; and an off site resource (without quoting); it's actually a really low quality answer imo. Commented Sep 17, 2019 at 9:10

2 Answers 2

3

SQL Server 2012 does not support executing external Python Scripts. As per the documentation for sp_execute_external_script (Transact-SQL):

Executes a script provided as an input argument to the procedure. Script runs in the extensibility framework. Script must be written in a supported and registered language, on a database engine having at least one extension: R, Python, or Java (in SQL Server 2019 preview only).

This then later goes on to state the following in the Remarks Section:

Use sp_execute_external_script to execute scripts written in a supported language. Currently, supported languages are R for SQL Server 2016 R Services, and Python and R for SQL Server 2017 Machine Learning Services.

You can also confirm the supported languages by version by looking at the Arguments section, specifically @Language:

@language = N'language'
Indicates the script language. language is sysname. Depending on your version of SQL Server, valid values are R (SQL Server 2016 and later), Python (SQL Server 2017 and later), and Java (SQL Server 2019 preview).

As you can see, you need at least 2017 to use sp_execute_external_script to execute a Python Script using the built in tools, and the earliest that can execute external Scripts is 2016 (and only R then).

This does not mean you couldn't do it a different way; such as using xp_cmdshell or using an SSIS package to call them, but we don't have any details on your end goal to give more information than this.

Sign up to request clarification or add additional context in comments.

1 Comment

Wow, the language in the document is bad a times; some of it is certainly written in what I would call "broken" English.
-1

I think that feature was introduced in SQL Server 2016, check this link out for more info https://www.mssqltips.com/sqlservertip/5036/installing-python-and-running-python-scripts-from-sql-server-ssms/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.