Skip to main content

sqliac-mssql

Microsoft SQL Server adapter for SQLIaC — a Terraform alternative for SQL databases that uses no state file.

This package provides the MSSQL database connector and credential handling so SQLIaC can query SQL Server's live state and execute DDL to reconcile your declared resource definitions.

Installation

pip install sqliac-mssql

This also installs sqliac (the CLI and core engine) and mssql-python (Microsoft's official SQL Server driver for Python).

Quick Start

Credentials

SQLIaC looks for MSSQL credentials in two places, in order of precedence:

1. Environment variables (recommended)

export MSSQL_HOST="localhost"
export MSSQL_USER="my_user"
export MSSQL_PASSWORD="my_password"
export MSSQL_DATABASE="my_db"
# Optional:
export MSSQL_PORT="1433"
export MSSQL_ENCRYPT="no"
export MSSQL_TRUST_SERVER_CERTIFICATE="yes"

mssql-python defaults to Encrypt=yes (mandatory TLS). For on-prem servers without a trusted certificate, set MSSQL_ENCRYPT=no or MSSQL_TRUST_SERVER_CERTIFICATE=yes, or connections will fail at handshake.

2. Configuration file .sqliac/provider/credentials.toml

[mssql]
host = "localhost"
user = "my_user"
password = "my_password"
database = "my_db"

Environment variables take precedence. Run sqliac init to scaffold this file.

Authentication is SQL login (user/password). Named instances can be given as host = "server\\INSTANCE" or via MSSQL_PORT.

Using SQLIaC with MSSQL

# Scaffold a project
sqliac init

# Configure your credentials and edit definitions/
# then preview and apply:

sqliac apply --dry-run
sqliac apply

Provider config

The adapter is registered via the sqliac.adapters entry point group. Your .sqliac/provider/config.toml should start with a top-level [mssql] section:

[mssql.schema.ddl_command]
create = "CREATE"
alter  = "ALTER"
drop   = "DROP"

[mssql.schema.ddl_context]
object_name = "analytics"
owner = "analytics_owner"
wait_time = 0

[mssql.schema.ddl_context.depends_on]

API

The adapter exposes three classes, all available from the top-level package:

from sqliac_mssql import MssqlAdapter, MssqlCredentials, MssqlConnectionManager
Class Role
MssqlAdapter Concrete BaseAdapter — executes queries and manages connections
MssqlCredentials Frozen dataclass — validates and stores host, user, password, database, etc.
MssqlConnectionManager Thread-safe per-thread connection pool (autocommit, so DDL runs outside transaction blocks)

All three are registered via the entry point sqliac.adapters / mssql and resolved automatically by the SQLIaC CLI. You don't need to import them directly unless building custom tooling.

Supported credential fields

Field Required Env var
host Yes MSSQL_HOST
user Yes MSSQL_USER
password Yes MSSQL_PASSWORD
database Yes MSSQL_DATABASE
port No (default 1433) MSSQL_PORT
encrypt No (driver default yes) MSSQL_ENCRYPT
trust_server_certificate No MSSQL_TRUST_SERVER_CERTIFICATE

License

MIT — see the sqliac package for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqliac_mssql-0.1.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqliac_mssql-0.1.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file sqliac_mssql-0.1.1.tar.gz.

File metadata

  • Download URL: sqliac_mssql-0.1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sqliac_mssql-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f9bc6d2e36ee097254c0acd2c57353d916d18a1685c4f0ed2cabc5c57d6e8e77
MD5 c63e7bdb9fe0371da1636d86d29afcc6
BLAKE2b-256 60336544e085a334988c048458a7e49b6b66f0fc724bbee829664784d9bd10f0

See more details on using hashes here.

File details

Details for the file sqliac_mssql-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sqliac_mssql-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for sqliac_mssql-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a8558c592b4e93b6c447401aabd1a20336a4dfce4def83c83eead962b4d8f004
MD5 2e21315712ac0ec6af73e4d6cafe1507
BLAKE2b-256 e66e005bd7e6c95bae32fab310c1ca5d94b8f691a0c63b363f203910519c2377

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

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