MSSQL

https://www.microsoft.com/sql-server

Install

Install Ibis and dependencies for the MSSQL backend:

Install with the mssql extra:

pip install 'ibis-framework[mssql]'

And connect:

import ibis

con = ibis.mssql.connect()
1
Adjust connection parameters as needed.

Install for MSSQL:

conda install -c conda-forge ibis-mssql

And connect:

import ibis

con = ibis.mssql.connect()
1
Adjust connection parameters as needed.

Install for MSSQL:

mamba install -c conda-forge ibis-mssql

And connect:

import ibis

con = ibis.mssql.connect()
1
Adjust connection parameters as needed.

Connect

ibis.mssql.connect

con = ibis.mssql.connect(
    user="username",
    password="password",
    host="hostname",
)
Note

ibis.mssql.connect is a thin wrapper around ibis.backends.mssql.Backend.do_connect.

Connection Parameters

do_connect

do_connect(self, host='localhost', user=None, password=None, port=1433, database=None, url=None, driver='pymssql')

ibis.connect URL format

In addition to ibis.mssql.connect, you can also connect to MSSQL by passing a properly formatted MSSQL connection URL to ibis.connect

con = ibis.connect(f"mssql://{user}:{password}@{host}:{port}")

mssql.Backend

create_database

create_database(self, name, force=False)

Create a new database.

Parameters

Name Type Description Default
name str Name of the new database. required
force bool If False, an exception is raised if the database already exists. False

create_schema

create_schema(self, name, database=None, force=False)

Create a schema named name in database.

Parameters

Name Type Description Default
name str Name of the schema to create. required
database str | None Name of the database in which to create the schema. If None, the current database is used. None
force bool If False, an exception is raised if the schema exists. False

drop_database

drop_database(self, name, force=False)

Drop a database with name name.

Parameters

Name Type Description Default
name str Database to drop. required
force bool If False, an exception is raised if the database does not exist. False

drop_schema

drop_schema(self, name, database=None, force=False)

Drop the schema with name in database.

Parameters

Name Type Description Default
name str Name of the schema to drop. required
database str | None Name of the database to drop the schema from. If None, the current database is used. None
force bool If False, an exception is raised if the schema does not exist. False

list_databases

list_databases(self, like=None)

List existing databases in the current connection.

Parameters

Name Type Description Default
like str | None A pattern in Python’s regex format to filter returned database names. None

Returns

Type Description
list[str] The database names that exist in the current connection, that match the like pattern if provided.
Back to top