Skip to content

Commit c2b0c4f

Browse files
Merge pull request #17480 from garyericson/10-06-prep-articles-for-mi
SQLML: Prepping articles for MI
2 parents b64812e + c8055c3 commit c2b0c4f

6 files changed

Lines changed: 157 additions & 139 deletions

docs/machine-learning/python/python-libraries-and-data-types.md

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,46 @@ title: Convert Python and SQL data types
33
description: Review the implicit and explicit data type conversions between Python and SQL Server in data science and machine learning solutions.
44
ms.prod: sql
55
ms.technology: machine-learning-services
6-
ms.date: 06/30/2020
6+
ms.date: 10/06/2020
77
ms.topic: conceptual
88
author: dphansen
99
ms.author: davidph
1010
ms.custom: seo-lt-2019
11-
monikerRange: ">=sql-server-2017||>=sql-server-linux-ver15||=sqlallproducts-allversions"
11+
monikerRange: ">=sql-server-2017||>=sql-server-linux-ver15||=azuresqldb-mi-current||=sqlallproducts-allversions"
1212
---
1313
# Data type mappings between Python and SQL Server
1414
[!INCLUDE [SQL Server 2017 and later](../../includes/applies-to-version/sqlserver2017.md)]
1515

16-
For Python solutions that run on the Python integration feature in SQL Server Machine Learning Services, review the list of unsupported data types, and data type conversions that might be performed implicitly when data is passed between Python and SQL Server.
16+
This article lists the supported data types, and the data type conversions performed, when using the Python integration feature in SQL Server Machine Learning Services.
1717

18-
## Python Version
19-
20-
A subset of the RevoScaleR functionality (rxLinMod, rxLogit, rxPredict, rxDTrees, rxBTrees, maybe a few others) is provided using Python APIs, using a new Python package **revoscalepy**. You can use this package to work with data using Pandas data frames, XDF files, or SQL data queries.
21-
22-
For more information, see [revoscalepy module in SQL Server](ref-py-revoscalepy.md) and [revoscalepy function reference](https://docs.microsoft.com/machine-learning-server/python-reference/revoscalepy/revoscalepy-package).
23-
24-
Python supports a limited number of data types in comparison to SQL Server. As a result, whenever you use data from SQL Server in Python scripts, data might be implicitly converted to a compatible data type. However, often an exact conversion cannot be performed automatically, and an error is returned.
18+
Python supports a limited number of data types in comparison to SQL Server. As a result, whenever you use data from SQL Server in Python scripts, SQL data might be implicitly converted to a compatible Python data type. However, often an exact conversion cannot be performed automatically and an error is returned.
2519

2620
## Python and SQL Data Types
2721

2822
This table lists the implicit conversions that are provided. Other data types are not supported.
2923

30-
|SQLtype|Python type|Description
31-
|-------|-----------|---------------------------------------------------------------------------------------------|
32-
|**bigint**|`float64`|
33-
|**binary**|`bytes`|
34-
|**bit**|`bool`|
35-
|**char**|`str`|
36-
|**date**|`datetime`|
37-
|**datetime**|`datetime`|Supported with SQL Server 2017 CU6 and above (with **NumPy** arrays of type `datetime.datetime` or **Pandas** `pandas.Timestamp`). `sp_execute_external_script` now supports `datetime` types with fractional seconds.|
38-
|**float**|`float64`|
39-
|**int**|`int32`|
40-
|**nchar**|`str`|
41-
|**nvarchar**|`str`|
42-
|**nvarchar(max)**|`str`|
43-
|**real**|`float64`|
44-
|**smalldatetime**|`datetime`|
45-
|**smallint**|`int32`|
46-
|**tinyint**|`int32`|
47-
|**uniqueidentifier**|`str`|
48-
|**varbinary**|`bytes`|
49-
|**varbinary(max)**|`bytes`|
50-
|**varchar(n)**|`str`|
51-
|**varchar(max)**|`str`|
24+
| SQL type | Python type | Description |
25+
|----------------------|-------------|-------------|
26+
| **bigint** | `float64` |
27+
| **binary** | `bytes` |
28+
| **bit** | `bool` |
29+
| **char** | `str` |
30+
| **date** | `datetime` |
31+
| **datetime** |`datetime` | Supported with SQL Server 2017 CU6 and above (with **NumPy** arrays of type `datetime.datetime` or **Pandas** `pandas.Timestamp`). `sp_execute_external_script` now supports `datetime` types with fractional seconds.|
32+
| **float** | `float64` |
33+
| **nchar** | `str` |
34+
| **nvarchar** | `str` |
35+
| **nvarchar(max)** | `str` |
36+
| **real** | `float64` |
37+
| **smalldatetime** | `datetime` |
38+
| **smallint** | `int32` |
39+
| **tinyint** | `int32` |
40+
| **uniqueidentifier** | `str` |
41+
| **varbinary** | `bytes` |
42+
| **varbinary(max)** | `bytes` |
43+
| **varchar(n)** | `str` |
44+
| **varchar(max)** | `str` |
45+
46+
## See also
47+
48+
+ [Data type mappings between R and SQL Server](../r/r-libraries-and-data-types.md)

0 commit comments

Comments
 (0)