airflow.providers.microsoft.mssql.hooks.mssql

Microsoft SQLServer hook module.

Module Contents

Classes

MsSqlHook

Interact with Microsoft SQL Server.

class airflow.providers.microsoft.mssql.hooks.mssql.MsSqlHook(*args, sqlalchemy_scheme=None, **kwargs)[source]

Bases: airflow.providers.common.sql.hooks.sql.DbApiHook

Interact with Microsoft SQL Server.

Parameters
  • args – passed to DBApiHook

  • sqlalchemy_scheme (str | None) – Scheme sqlalchemy connection. Default is mssql+pymssql Only used for get_sqlalchemy_engine and get_sqlalchemy_connection methods.

  • kwargs – passed to DbApiHook

property sqlalchemy_scheme: str[source]

Sqlalchemy scheme either from constructor, connection extras or default.

conn_name_attr = 'mssql_conn_id'[source]
default_conn_name = 'mssql_default'[source]
conn_type = 'mssql'[source]
hook_name = 'Microsoft SQL Server'[source]
supports_autocommit = True[source]
DEFAULT_SQLALCHEMY_SCHEME = 'mssql+pymssql'[source]
get_uri()[source]

Extract the URI from the connection.

Returns

the extracted uri.

Return type

str

get_sqlalchemy_connection(connect_kwargs=None, engine_kwargs=None)[source]

Sqlalchemy connection object.

get_primary_keys(table)[source]
get_conn()[source]

Return pymssql connection object.

set_autocommit(conn, autocommit)[source]

Set the autocommit flag on the connection.

get_autocommit(conn)[source]

Get autocommit setting for the provided connection.

Parameters

conn (pymssql.Connection) – Connection to get autocommit setting from.

Returns

connection autocommit setting. True if autocommit is set to True on the connection. False if it is either not set, set to False, or the connection does not support auto-commit.

Was this entry helpful?