class SqlServerContainer(image: str = 'mcr.microsoft.com/mssql/server:2019-latest', username: str = 'SA', password: str | None = None, port: int = 1433, dbname: str = 'tempdb', dialect: str = 'mssql+pymssql', **kwargs)ΒΆ

Microsoft SQL Server database container.

Example

>>> import sqlalchemy
>>> from testcontainers.mssql import SqlServerContainer

>>> with SqlServerContainer("mcr.microsoft.com/mssql/server:2022-CU12-ubuntu-22.04") as mssql:
...    engine = sqlalchemy.create_engine(mssql.get_connection_url())
...    with engine.begin() as connection:
...        result = connection.execute(sqlalchemy.text("select @@VERSION"))