专家介绍,
只是好奇才知道。有没有办法在任何sql server中执行python脚本?
如果是这样,请提供一些参考链接
我不是专家,但最近看起来这个,所以这里有一个非常简单的T-SQL脚本,嵌入式Python,如果它可以帮助任何人(注意:假设你已经在SQL Server上设置了Machine Learning Services with Python)。
-- Stored proc which runs embedded Machine Learning Services scripts
EXEC sp_execute_external_script
-- The SQL query to be input to the Python script
@input_data_1 = N'SELECT TOP(100) [CustomerID], [JobNumber]
FROM [dbo].[Heading] ORDER BY DateDelivery DESC',
-- Variable name for the input SQL data ('InputDataSet' is the default if none)
@input_data_1_name = N'InputDataSet',
-- The language of the script
@language = N'Python',
-- Python script itself - Just imports Pandas and creates a new DataFrame with only one of the two input columns
@script = N'
import pandas as pd
OutputDataSet = pd.DataFrame(InputDataSet["CustomerID"])
'
-- Declaring SQL columns for the output (a Pandas DataFrame)
WITH RESULT SETS (
("CustomerID" INT NULL)
)