Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server 2017 (14.x) and later
Azure SQL Managed Instance
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.
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.
Python and SQL Data Types
This table lists the implicit conversions that are provided. Other data types are not supported.
SQL type | Python type | Description |
---|---|---|
bigint | float64 |
|
binary | bytes |
|
bit | bool |
|
char | str |
|
date | datetime |
|
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. |
float | float64 |
|
nchar | str |
|
nvarchar | str |
|
nvarchar(max) | str |
|
real | float64 |
|
smalldatetime | datetime |
|
smallint | int32 |
|
tinyint | int32 |
|
uniqueidentifier | str |
|
varbinary | bytes |
|
varbinary(max) | bytes |
|
varchar(n) | str |
|
varchar(max) | str |