Hi, I would like to set my X and Y axis and XY matrix from SQL. Call Python from SQL to resolve many X,Y interpolations (cubic). I have already done part of the job, but I need help to achieve that...
' see attachment
IF OBJECT_ID('tempdb..#X') IS NOT NULL DROP TABLE #X
IF OBJECT_ID('tempdb..#Y') IS NOT NULL DROP TABLE #Y
IF OBJECT_ID('tempdb..#XY') IS NOT NULL DROP TABLE #XY
IF OBJECT_ID('tempdb..#2RESOLVE') IS NOT NULL DROP TABLE #2RESOLVE
SELECT value INTO #X FROM string_split('5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95',',')
SELECT value INTO #Y FROM string_split('30,60,90,180,270,360,540',',')
SELECT * INTO #XY FROM
SELECT 1 as Col1,2 as Col2,3 as Col3,4 as Col4,5 as Col5,6 as Col6, 7 as Col7,8 as Col8,9 as Col9,10 as Col10,11 as Col11,12 as Col12,13 as Col13,14 as Col14,15 as Col15,16 as Col16,17 as Col17,18 as Col18,19 as Col19 UNION
SELECT 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22 UNION
SELECT 7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25 UNION
SELECT 11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29 UNION
SELECT 14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 UNION
SELECT 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35 UNION
-- here is the X,Y cooronates to interpolates
SELECT * INTO #2RESOLVE
SELECT 17 as X, 33 as Y UNION -- 3.66257701
SELECT 19, 44 UNION -- 5.11648115
SELECT 24, 52 UNION -- 6.94579056
SELECT 34, 63 UNION -- 10.12166594
SELECT 41, 69 UNION -- 12.15974548
SELECT 56, 74 -- 15.67988759
EXECUTE sp_execute_external_script @language = N'Python'
, @script = N'
from scipy import interpolate
xx = [login to view URL](X,Y,XY,kind=''cubic'' )
# loop all the #2RESOLVE X,Y to interpolates
,@input_data_1 = N'SELECT * FROM #X'
,@input_data_1_name = N'X'
,@input_data_2 = N'SELECT * FROM #Y'
,@input_data_2_name = N'Y'
,@input_data_3 = N'SELECT * FROM #XY'
,@input_data_3_name = N'XY'
,@output_data_1_name = N'OutputDataSet'