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.0.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.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqliac_mssql-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 4da35782be0c2ff15f6cfaac730cb1c23d540aa8cd052511194c784f48e7fa99
MD5 ed16ead4a3121a97cd9b48d04a5d3073
BLAKE2b-256 e9ea7a3e17c50eb92af1221e3788106696edb156170ea903ed328d879f6387be

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqliac_mssql-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54262a26490ed5351de0cba360793d0f271219095c2efdb46bd58068b72e6edb
MD5 a21b25151b23255b8ac0ba4af45d5755
BLAKE2b-256 ae824193691957a92f3a0845e0f597ea3c33546b284cb31118d7908b66aaa465

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.1

2 files

This release

0.1.0 This release

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