Skip to main content

Microsoft SQL Server Python connector

The Python package exposes the manifest's query, execute, and executeNonIdempotent operations through native python-tds sessions. Each attempt resolves the current private password, opens one SQL Server connection, pins session settings, and closes it. It never persists the password in Flow input, output, a receipt, or an Attribute.

Install and configure

Install dex-connector-microsoft-sql-server==0.2.0. Create a Dex Web connection named sqlserver-refunds for the runnable example, following the authorization guide in the connector README. The connection needs a host, database, SQL authentication user and secret password. Port, timeouts, row limits, and encryption have manifest defaults.

The Python package supports encrypt=mandatory with a verified server certificate from the system CA file, a bundled certifi CA fallback when Python exposes no system CA file, or SQLSERVER_SSL_CA on the Worker host. An explicitly configured CA path must exist. Hostname verification uses Subject Alternative Names, including DNS names and IP addresses; a Common Name alone is insufficient. encrypt=disable is allowed only for localhost, 127.0.0.1, or ::1. python-tds 1.17.1 has no public per-connection mode for TDS 8.0 strict encryption or for encryption without certificate validation. The Python package therefore rejects encrypt=strict and encrypt=trust-server-certificate during client construction, before any network connection. These modes remain supported by the Go connector. Choose the Go connector if either is required; do not change Python's setting to another mode without reviewing the server's TLS requirements.

python-tds converts SQL Server TIME, DATETIME2, and DATETIMEOFFSET values to Python's microsecond-resolution types. For a result column with scale 7, this package selects invalidResponse and names the column before emitting any row, because the seventh fractional digit would otherwise be lost. Use a SQL CAST to scale 6 or lower when microsecond precision is sufficient. Scales 0 through 6 retain their exact values. The package restores declared DECIMAL/NUMERIC scale and MONEY/SMALLMONEY's four decimal places after driver decoding. It returns serialized GEOGRAPHY, GEOMETRY, and HIERARCHYID values as base64 with their SQL type names. Unknown SQL types fail invalidResponse.

Operations

new_query_step runs a parameterized SELECT or WITH statement in a transaction. Closing its connection without COMMIT makes SQL Server roll it back. It returns completed with bounded rows, truncated when the row or JSON byte bound is reached, providerRejected for conclusive SQL Server errors, invalidResponse for undecodable values, and defect for invalid local input. Transient failures retry.

new_execute_step runs one parameterized INSERT, UPDATE, DELETE, MERGE, or WITH statement in its own transaction. The optional final @pN idempotency-key placeholder binds Dex's stable Call ID. A write that exceeds maxRowsAffected or an OUTPUT bound rolls back and selects limitExceeded. execute is repeatOnUnknown: safe: a failed COMMIT whose outcome is unknown returns Retry and the statement runs again, so it never selects uncertain. Failures before COMMIT retry only when safe. Make every execute statement repeat-safe across retries and Worker replacement.

new_execute_non_idempotent_step takes the same input for a statement that must not run twice, such as a relative balance update. executeNonIdempotent is repeatOnUnknown: unsafe: it records a single-dispatch claim in the sync Step heartbeat before COMMIT, selects uncertain when COMMIT bytes may have reached the server, and selects uncertain without connecting on a later attempt after such a COMMIT or a lost Worker. A COMMIT that sent no bytes, or a proven rollback such as a deadlock victim, returns Retry; an unreadable checkpoint returns Retry without connecting. new_connection_with_operations keeps its (query, execute, reference) order and accepts the new operation as the keyword-only execute_non_idempotent; a connection built without it raises ValueError when an executeNonIdempotent Step is constructed. rowsAffected sums all SQL Server DONE counts, including trigger statements. If the server supplies no count, maxRowsAffected fails invalidResponse before COMMIT. Receipts include the session process ID and server version; server errors add number, state, and severity. The connector enforces an attempt deadline and a response read budget in addition to the configured row and JSON response bounds. Exhausting the read budget returns truncated query rows or closes an execute session before COMMIT, causing SQL Server to roll it back.

Both operations accept @p1 through @pN positional parameters in SQL text. Do not interpolate user input into the statement. The connector checks for one allowed statement, rejects transaction control and other reserved operations, and binds values through python-tds named parameters. Python None binds as a SQL NULL literal, small integers bind as SQL INT, and timezone-aware datetime inputs are unsupported. Use explicit SQL casts when a parameter needs a specific SQL type. Read the runnable Flow for the exact application call pattern.

Verification

The package unit tests cover routing, driver error numbers, input validation, row bounds, commit retries, and executeNonIdempotent fencing. The example integration test runs its Worker and Client against a real dexcli dev server with scripted connector operations. The SQL Server service-container workflow runs tests/integration/test_database.py; its mandatory TLS pass depends on the separate CI workflow change in PR #518. No live SQL Server, Azure SQL Database, or Azure SQL Managed Instance has been verified through a user-controlled Dex Web connection for this Python package.

Metadata

Release files for dex-connector-microsoft-sql-server 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dex-connector-microsoft-sql-server 0.2.0
File Size Uploaded Provenance Actions
dex_connector_microsoft_sql_server-0.2.0.tar.gz 101.6 kB Without provenance Details for dex_connector_microsoft_sql_server-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dex-connector-microsoft-sql-server 0.2.0
File Interpreter ABI Platform Actions
dex_connector_microsoft_sql_server-0.2.0-py3-none-any.whl Python 3 none any Details for dex_connector_microsoft_sql_server-0.2.0-py3-none-any.whl

Total release size: 137.5 kB

Release files / dex_connector_microsoft_sql_server-0.2.0.tar.gz

Download URL dex_connector_microsoft_sql_server-0.2.0.tar.gz
Size 101.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cfd7fb0b0b2b8ab617e329ce80a6b3e37185c48bedf94012e78b6d58b624c12c
BLAKE2b-256 checksum
How to use checksums
db6da09a661d1e561fac382c289fab0588974226be5d267b22050295cbcf1cc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / dex_connector_microsoft_sql_server-0.2.0-py3-none-any.whl

Download URL dex_connector_microsoft_sql_server-0.2.0-py3-none-any.whl
Size 36.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e8d49ccbca5d22700c2ced6b67f3dce3ad4462aeba99f3824cccf27c31364a6
BLAKE2b-256 checksum
How to use checksums
4c3ae7369e64dfa1ce7dc153d96f75a164d58b8eb3206b96f276227fc5c0b9c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for dex-connector-microsoft-sql-server 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page