How do I create a Python CLR procedure in SQL Server?

Viewed 2955

We want to call some python from tsql on sql server 2008.

The python script is fully developed and works great. We cannot trigger anything from the client app because it is closed source and cannot be modified.

So we have full access to SQL Server (2005 and 2008), and can see that "trigger" record get inserted... and need to fire our python code when that happens.

Rather than using xp_cmdshell to launch an old fashioned python script, we would like to do this as "sql native" as we can. (xp_cmdshell will work, but is scary at a few levels.)

What is the path to do this?

2 Answers

This is now possible in SQL Server 2017. It's not using SQL CLR, but the new external script runtime functionality that supports R, Python, and (in SQL 2019) Java.

See Run Python using T-SQL

Related