MicrosoftDocs / feedback

📢 docs.microsoft.com site feedback
https://learn.microsoft.com
Creative Commons Attribution 4.0 International
240 stars 159 forks source link

RuntimeError: The type numpy.ndarray(decimal.Decimal) for line-number is not supported. #3201

Closed ranga-oskar closed 3 years ago

ranga-oskar commented 4 years ago

I am trying to import a table from DynamoDB to SQL Server using extended Python Script. My configuration setup: Windows version 10. Sql Server Developer version 2017, local in my AWS workspace. Installed Anaconda Python version 3.5, update packages by running "conda update --all" ran 'pip install boto3', upgraded pip by running "python -m pip install --upgrade pip"

Tried to use the example given in the following link: https://www.mssqltips.com/sqlservertip/5621/importing-data-from-aws-dynamodb-into-sql-server-2017/

Resolved the error : socket.error: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions, by editing an outbound firewall rule. Right click "allow" on rule "Block network access for R local user accounts in SQL Server instance MSSQLSERVER".

Below is the code and the latest error message:

I have created the table cspdata in sql. I don't have any Numeric data type column in my table. Only varchar, int and bit.

Python code in sql server executed using sql management studio:

declare @rScript NVARCHAR(MAX) set @rScript = N' import boto3 import pandas as pd dbConn = boto3.resource("dynamodb", aws_access_key_id ="XXXXXXXXXXX", aws_secret_access_key ="XXXXXXXXXXXXXX", region_name="us-east-1") table = dbConn.Table("cspdata") table = table.scan() tableContents = table["Items"] contentsList = [] for item in tableContents: contentsList.append(item)

od = pd.DataFrame(contentsList, columns=["id", "blocked-uri", "document-uri", "original-policy", "referrer", "script-sample", "source-file", "timestamp","violated-directive","line-number","disposition","effective-directive","status-code","column-number"]) OutputDataSet = od '

exec sp_execute_external_script @language = N'Python', @script = @rScript WITH RESULT SETS (( "id" varchar(100),"blocked-uri" varchar(100),"document-uri" varchar(100),"original-policy" varchar(500),"referrer" varchar(100),"script-sample" varchar(200),"source-file" varchar(200),"timestamp" int,"violated-directive" varchar(100),"line-number" int,"disposition" varchar(50),"effective-directive" varchar(50),"status-code" BIT,"column-number" int));

==========================

Here is the error :

Msg 39004, Level 16, State 20, Line 0 A 'Python' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004. Msg 39019, Level 16, State 2, Line 0 An external script error occurred:

Invalid BXL stream

STDOUT message(s) from external script: SqlSatelliteCall function failed. Please see the console output for more information. Traceback (most recent call last): File "C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\PYTHON_SERVICES\lib\site-packages\revoscalepy\computecontext\RxInSqlServer.py", line 406, in rx_sql_satellite_call rx_native_call("SqlSatelliteCall", params) File "C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\PYTHON_SERVICES\lib\site-packages\revoscalepy\RxSerializable.py", line 291, in rx_native_call ret = px_call(functionname, params) RuntimeError: The type numpy.ndarray(decimal.Decimal) for line-number is not supported.

========================= To handle the external script error occurred: Invalid BXL stream, I have created a system variable as below and restarted the sql server Launchpad service. Set variable name to 'MKL_CBWR'. Set the 'Variable value' to 'AUTO'.

welcome[bot] commented 4 years ago

Thank you for creating the issue! One of our team members will get back to you shortly with additional information. If this is a product issue, please close this and contact the particular product's support instead (see https://support.microsoft.com/allproducts for the list of support websites).

rootsmusic commented 3 years ago

@ranga-oskar Please ask product support or in support forums at https://docs.microsoft.com/en-us/sql/sql-server/sql-server-get-help?view=sql-server-ver15

please-close

tynevi commented 5 months ago

@ranga-oskar - This issue was flagged by GitHub secret scanning for having contained a secret - we recommend you revoke that secret if it is still in use.