Microsoft SQL Server

Driver Version v1.0.0 Tested With SQL Server 2022

This driver provides access to Microsoft SQL Server .

Note

This project is not affiliated with Microsoft.

Installation

The Microsoft SQL Server driver can be installed with dbc :

dbc install mssql

Connecting

To connect, edit the uri option below to match your environment and run the following:

from adbc_driver_manager import dbapi

dbapi.connect(
    driver="mssql",
    db_kwargs={
        "uri": "sqlserver://sa:Co1umn&r@localhost:1433?database=demo"
    }
)

Note: The example above is for Python using the adbc-driver-manager package but the process will be similar for other driver managers.

Feature & Type Support

Feature Support
Bulk Ingestion Create
Append
Create/Append
Replace
Temporary Table
Specify target catalog
Specify target schema
Non-nullable fields are marked NOT NULL
Catalog (GetObjects) depth=catalogs
depth=db_schemas
depth=tables
depth=columns (all)
Get Parameter Schema
Get Table Schema
Prepared Statements
Transactions

Types

SQL Server to Arrow

SQL Type

Arrow Type

BIGINT

int64

BIT

bool

DATE

date32[day]

DATETIME

timestamp[us, tz=UTC]

DATETIME2

timestamp[us, tz=UTC]

DOUBLE PRECISION

double

INT

int32

NUMERIC

decimal128

REAL

float

SMALLINT

int16

TIME

time64[ns] ⚠️ [1]

TIME(0)

time32[s]

TIME(1)

time32[ms]

TIME(2)

time32[ms]

TIME(3)

time32[ms]

TIME(4)

time64[us]

TIME(5)

time64[us]

TIME(6)

time64[us]

TIME(7)

time64[ns]

VARBINARY

binary

VARCHAR

string

Arrow to SQL Server

Arrow Type SQL Server Type
Bind Ingest
binary VARBINARY VARBINARY(MAX)
bool BOOLEAN BIT
date32[day] DATE
decimal128 NUMERIC
double DOUBLE PRECISION
float REAL
int16 SMALLINT
int32 INT
int64 BIGINT
string VARCHAR NTEXT
time32[ms] TIME(1), TIME(2), TIME(3)

TIME(7) ⚠️ [2]

time32[s] TIME(0)

TIME(7) ⚠️ [2]

time64[ns] TIME(7)

TIME(7) ⚠️ [3]

time64[us] TIME, TIME(4), TIME(5), TIME(6)

TIME(7) ⚠️ [2]

timestamp[us] DATETIME n/a
timestamp[us, tz=UTC] n/a DATETIME2

Previous Versions

To see documentation for the current and previous versions of this driver, see the following: