Load data into pandas dataframe into ms sql python
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'm trying to built a Python model within MS SQL SERVER 2017. I've attempted to use some tutorials but the result was far from expected. I'm wondering what's wrong with this script (loading SQL Table into pandas dataframe):
USE PREPRESS_TMP;
GO
EXEC sp_execute_external_script
@language=N'Python',
@script=N'
dataset = pandas.DataFrame(input_data)
',
@input_data_1 = N'Select * FROM dbo.Rests_GO'
GO
The error message is:
STDOUT message(s) from external script:
Express Edition will continue to be enforced.
SqlSatelliteCall function failed. Please see the console output for more information.
Traceback (most recent call last):
File "C:Program FilesMicrosoft SQL
ServerMSSQL14.MSSQLSERVERPYTHON_SERVICESlibsite-packagesrevoscalepycomputecontextRxInSqlServer.py", line 406, in
rx_sql_satellite_call
rx_native_call("SqlSatelliteCall", params)
File "C:Program FilesMicrosoft SQL
ServerMSSQL14.MSSQLSERVERPYTHON_SERVICESlibsite-packagesrevoscalepyRxSerializable.py", line 291, in rx_native_call
ret = px_call(functionname, params)
RuntimeError: revoscalepy function failed.
I'll be glad to accept any help.
python sql-server pandas dataframe
add a comment |
I'm trying to built a Python model within MS SQL SERVER 2017. I've attempted to use some tutorials but the result was far from expected. I'm wondering what's wrong with this script (loading SQL Table into pandas dataframe):
USE PREPRESS_TMP;
GO
EXEC sp_execute_external_script
@language=N'Python',
@script=N'
dataset = pandas.DataFrame(input_data)
',
@input_data_1 = N'Select * FROM dbo.Rests_GO'
GO
The error message is:
STDOUT message(s) from external script:
Express Edition will continue to be enforced.
SqlSatelliteCall function failed. Please see the console output for more information.
Traceback (most recent call last):
File "C:Program FilesMicrosoft SQL
ServerMSSQL14.MSSQLSERVERPYTHON_SERVICESlibsite-packagesrevoscalepycomputecontextRxInSqlServer.py", line 406, in
rx_sql_satellite_call
rx_native_call("SqlSatelliteCall", params)
File "C:Program FilesMicrosoft SQL
ServerMSSQL14.MSSQLSERVERPYTHON_SERVICESlibsite-packagesrevoscalepyRxSerializable.py", line 291, in rx_native_call
ret = px_call(functionname, params)
RuntimeError: revoscalepy function failed.
I'll be glad to accept any help.
python sql-server pandas dataframe
add a comment |
I'm trying to built a Python model within MS SQL SERVER 2017. I've attempted to use some tutorials but the result was far from expected. I'm wondering what's wrong with this script (loading SQL Table into pandas dataframe):
USE PREPRESS_TMP;
GO
EXEC sp_execute_external_script
@language=N'Python',
@script=N'
dataset = pandas.DataFrame(input_data)
',
@input_data_1 = N'Select * FROM dbo.Rests_GO'
GO
The error message is:
STDOUT message(s) from external script:
Express Edition will continue to be enforced.
SqlSatelliteCall function failed. Please see the console output for more information.
Traceback (most recent call last):
File "C:Program FilesMicrosoft SQL
ServerMSSQL14.MSSQLSERVERPYTHON_SERVICESlibsite-packagesrevoscalepycomputecontextRxInSqlServer.py", line 406, in
rx_sql_satellite_call
rx_native_call("SqlSatelliteCall", params)
File "C:Program FilesMicrosoft SQL
ServerMSSQL14.MSSQLSERVERPYTHON_SERVICESlibsite-packagesrevoscalepyRxSerializable.py", line 291, in rx_native_call
ret = px_call(functionname, params)
RuntimeError: revoscalepy function failed.
I'll be glad to accept any help.
python sql-server pandas dataframe
I'm trying to built a Python model within MS SQL SERVER 2017. I've attempted to use some tutorials but the result was far from expected. I'm wondering what's wrong with this script (loading SQL Table into pandas dataframe):
USE PREPRESS_TMP;
GO
EXEC sp_execute_external_script
@language=N'Python',
@script=N'
dataset = pandas.DataFrame(input_data)
',
@input_data_1 = N'Select * FROM dbo.Rests_GO'
GO
The error message is:
STDOUT message(s) from external script:
Express Edition will continue to be enforced.
SqlSatelliteCall function failed. Please see the console output for more information.
Traceback (most recent call last):
File "C:Program FilesMicrosoft SQL
ServerMSSQL14.MSSQLSERVERPYTHON_SERVICESlibsite-packagesrevoscalepycomputecontextRxInSqlServer.py", line 406, in
rx_sql_satellite_call
rx_native_call("SqlSatelliteCall", params)
File "C:Program FilesMicrosoft SQL
ServerMSSQL14.MSSQLSERVERPYTHON_SERVICESlibsite-packagesrevoscalepyRxSerializable.py", line 291, in rx_native_call
ret = px_call(functionname, params)
RuntimeError: revoscalepy function failed.
I'll be glad to accept any help.
python sql-server pandas dataframe
python sql-server pandas dataframe
asked Nov 26 '18 at 13:31
Catherine NosovaCatherine Nosova
437
437
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
You're using Express Edition right? See this: https://docs.microsoft.com/en-us/sql/sql-server/editions-and-components-of-sql-server-2017?view=sql-server-2017.
There's nothing wrong with your code though you should include the input data to be clear as below
use AdventureWorksDW2014
go
EXEC sp_execute_external_script
@language =N'Python',
@script= N'
import pandas as pd
from pandas import DataFrame
OutputDataSet = pd.DataFrame(InputDataSet.describe())
',
@input_data_1 = N'SELECT
CAST(TotalProductCost AS float)
, CAST(UnitPrice AS Float)
, CAST(OrderQuantity AS FLOAT)
FROM FactInternetSales'
with result sets ((
TotalProductCost float
, UnitPrice Float
, OrderQuantity FLOAT
))
add a comment |
Although I can't answer your errors, you do need another parameter "input_data_x_name" for the code to work:
EXEC sp_execute_external_script
@language=N'Python',
@script=N'dataset = pandas.DataFrame(input_data)',
@input_data_1 = N'Select * FROM dbo.Rests_GO',
@input_data_1_name = N'input_data'
add a comment |
Although Express Edition is one of the SQL Server editions, this message is subtly different and it's telling you that Python client libraries are licensed under the limitations of SQL Server's Express Edition. You can safely ignore it unless you're concerned about scalability further down the line. You'll actually see the same error message about limits (in-memory data sets and a maximum of 2-core processing) on SQL Server Standard Edition - I've seen it numerous times, and have just double checked it for accuracy.
In summary the first message is an informational message, not an error message, so you can safely ignore that part of the output.
The second part of the message is what you want to focus on (almost invariably when debugging this type of TSQL/Python code).
Therefore, user3912517's solution given above is the correct one, though it might be useful to understand why.
Simple explanation:
Python needs to reference the data set passed into it from SQL Server with a name.
It does this via the @input_data_1_name parameter, which effectively "names" the data returned by the query defined in @input_data_1.
This provides the link between the data set returned by the query that's run in the SQL Server environment and the dataframe that the Python code needs to reference the same data set in the Python environment.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53482228%2fload-data-into-pandas-dataframe-into-ms-sql-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You're using Express Edition right? See this: https://docs.microsoft.com/en-us/sql/sql-server/editions-and-components-of-sql-server-2017?view=sql-server-2017.
There's nothing wrong with your code though you should include the input data to be clear as below
use AdventureWorksDW2014
go
EXEC sp_execute_external_script
@language =N'Python',
@script= N'
import pandas as pd
from pandas import DataFrame
OutputDataSet = pd.DataFrame(InputDataSet.describe())
',
@input_data_1 = N'SELECT
CAST(TotalProductCost AS float)
, CAST(UnitPrice AS Float)
, CAST(OrderQuantity AS FLOAT)
FROM FactInternetSales'
with result sets ((
TotalProductCost float
, UnitPrice Float
, OrderQuantity FLOAT
))
add a comment |
You're using Express Edition right? See this: https://docs.microsoft.com/en-us/sql/sql-server/editions-and-components-of-sql-server-2017?view=sql-server-2017.
There's nothing wrong with your code though you should include the input data to be clear as below
use AdventureWorksDW2014
go
EXEC sp_execute_external_script
@language =N'Python',
@script= N'
import pandas as pd
from pandas import DataFrame
OutputDataSet = pd.DataFrame(InputDataSet.describe())
',
@input_data_1 = N'SELECT
CAST(TotalProductCost AS float)
, CAST(UnitPrice AS Float)
, CAST(OrderQuantity AS FLOAT)
FROM FactInternetSales'
with result sets ((
TotalProductCost float
, UnitPrice Float
, OrderQuantity FLOAT
))
add a comment |
You're using Express Edition right? See this: https://docs.microsoft.com/en-us/sql/sql-server/editions-and-components-of-sql-server-2017?view=sql-server-2017.
There's nothing wrong with your code though you should include the input data to be clear as below
use AdventureWorksDW2014
go
EXEC sp_execute_external_script
@language =N'Python',
@script= N'
import pandas as pd
from pandas import DataFrame
OutputDataSet = pd.DataFrame(InputDataSet.describe())
',
@input_data_1 = N'SELECT
CAST(TotalProductCost AS float)
, CAST(UnitPrice AS Float)
, CAST(OrderQuantity AS FLOAT)
FROM FactInternetSales'
with result sets ((
TotalProductCost float
, UnitPrice Float
, OrderQuantity FLOAT
))
You're using Express Edition right? See this: https://docs.microsoft.com/en-us/sql/sql-server/editions-and-components-of-sql-server-2017?view=sql-server-2017.
There's nothing wrong with your code though you should include the input data to be clear as below
use AdventureWorksDW2014
go
EXEC sp_execute_external_script
@language =N'Python',
@script= N'
import pandas as pd
from pandas import DataFrame
OutputDataSet = pd.DataFrame(InputDataSet.describe())
',
@input_data_1 = N'SELECT
CAST(TotalProductCost AS float)
, CAST(UnitPrice AS Float)
, CAST(OrderQuantity AS FLOAT)
FROM FactInternetSales'
with result sets ((
TotalProductCost float
, UnitPrice Float
, OrderQuantity FLOAT
))
answered Jan 4 at 0:07
SamTSamT
11112
11112
add a comment |
add a comment |
Although I can't answer your errors, you do need another parameter "input_data_x_name" for the code to work:
EXEC sp_execute_external_script
@language=N'Python',
@script=N'dataset = pandas.DataFrame(input_data)',
@input_data_1 = N'Select * FROM dbo.Rests_GO',
@input_data_1_name = N'input_data'
add a comment |
Although I can't answer your errors, you do need another parameter "input_data_x_name" for the code to work:
EXEC sp_execute_external_script
@language=N'Python',
@script=N'dataset = pandas.DataFrame(input_data)',
@input_data_1 = N'Select * FROM dbo.Rests_GO',
@input_data_1_name = N'input_data'
add a comment |
Although I can't answer your errors, you do need another parameter "input_data_x_name" for the code to work:
EXEC sp_execute_external_script
@language=N'Python',
@script=N'dataset = pandas.DataFrame(input_data)',
@input_data_1 = N'Select * FROM dbo.Rests_GO',
@input_data_1_name = N'input_data'
Although I can't answer your errors, you do need another parameter "input_data_x_name" for the code to work:
EXEC sp_execute_external_script
@language=N'Python',
@script=N'dataset = pandas.DataFrame(input_data)',
@input_data_1 = N'Select * FROM dbo.Rests_GO',
@input_data_1_name = N'input_data'
answered Jan 4 at 0:29
user3912517user3912517
312
312
add a comment |
add a comment |
Although Express Edition is one of the SQL Server editions, this message is subtly different and it's telling you that Python client libraries are licensed under the limitations of SQL Server's Express Edition. You can safely ignore it unless you're concerned about scalability further down the line. You'll actually see the same error message about limits (in-memory data sets and a maximum of 2-core processing) on SQL Server Standard Edition - I've seen it numerous times, and have just double checked it for accuracy.
In summary the first message is an informational message, not an error message, so you can safely ignore that part of the output.
The second part of the message is what you want to focus on (almost invariably when debugging this type of TSQL/Python code).
Therefore, user3912517's solution given above is the correct one, though it might be useful to understand why.
Simple explanation:
Python needs to reference the data set passed into it from SQL Server with a name.
It does this via the @input_data_1_name parameter, which effectively "names" the data returned by the query defined in @input_data_1.
This provides the link between the data set returned by the query that's run in the SQL Server environment and the dataframe that the Python code needs to reference the same data set in the Python environment.
add a comment |
Although Express Edition is one of the SQL Server editions, this message is subtly different and it's telling you that Python client libraries are licensed under the limitations of SQL Server's Express Edition. You can safely ignore it unless you're concerned about scalability further down the line. You'll actually see the same error message about limits (in-memory data sets and a maximum of 2-core processing) on SQL Server Standard Edition - I've seen it numerous times, and have just double checked it for accuracy.
In summary the first message is an informational message, not an error message, so you can safely ignore that part of the output.
The second part of the message is what you want to focus on (almost invariably when debugging this type of TSQL/Python code).
Therefore, user3912517's solution given above is the correct one, though it might be useful to understand why.
Simple explanation:
Python needs to reference the data set passed into it from SQL Server with a name.
It does this via the @input_data_1_name parameter, which effectively "names" the data returned by the query defined in @input_data_1.
This provides the link between the data set returned by the query that's run in the SQL Server environment and the dataframe that the Python code needs to reference the same data set in the Python environment.
add a comment |
Although Express Edition is one of the SQL Server editions, this message is subtly different and it's telling you that Python client libraries are licensed under the limitations of SQL Server's Express Edition. You can safely ignore it unless you're concerned about scalability further down the line. You'll actually see the same error message about limits (in-memory data sets and a maximum of 2-core processing) on SQL Server Standard Edition - I've seen it numerous times, and have just double checked it for accuracy.
In summary the first message is an informational message, not an error message, so you can safely ignore that part of the output.
The second part of the message is what you want to focus on (almost invariably when debugging this type of TSQL/Python code).
Therefore, user3912517's solution given above is the correct one, though it might be useful to understand why.
Simple explanation:
Python needs to reference the data set passed into it from SQL Server with a name.
It does this via the @input_data_1_name parameter, which effectively "names" the data returned by the query defined in @input_data_1.
This provides the link between the data set returned by the query that's run in the SQL Server environment and the dataframe that the Python code needs to reference the same data set in the Python environment.
Although Express Edition is one of the SQL Server editions, this message is subtly different and it's telling you that Python client libraries are licensed under the limitations of SQL Server's Express Edition. You can safely ignore it unless you're concerned about scalability further down the line. You'll actually see the same error message about limits (in-memory data sets and a maximum of 2-core processing) on SQL Server Standard Edition - I've seen it numerous times, and have just double checked it for accuracy.
In summary the first message is an informational message, not an error message, so you can safely ignore that part of the output.
The second part of the message is what you want to focus on (almost invariably when debugging this type of TSQL/Python code).
Therefore, user3912517's solution given above is the correct one, though it might be useful to understand why.
Simple explanation:
Python needs to reference the data set passed into it from SQL Server with a name.
It does this via the @input_data_1_name parameter, which effectively "names" the data returned by the query defined in @input_data_1.
This provides the link between the data set returned by the query that's run in the SQL Server environment and the dataframe that the Python code needs to reference the same data set in the Python environment.
answered Feb 11 at 14:37
JonJon
594
594
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53482228%2fload-data-into-pandas-dataframe-into-ms-sql-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown