Piece

Python Script [SQL] sp_configure sp_execute_external_script

More Code 2018. 6. 30. 08:31


-- Allow to execute external scripts such as R and Python
EXEC sp_configure 'external scripts enabled', 1;
RECONFIGURE WITH OVERRIDE;
GO

-- Restart SQL Server to apply changes

-- Check whether the Python script works well or not
EXEC sp_execute_external_script
@language = N'Python',
@script = N'
import sys
import numpy as np
import pandas as pd
print(sys.version)
print(np.__version__)
print(pd.__version__)
';