airflow.providers.microsoft.mssql.hooks.mssql

Microsoft SQLServer hook module.

Classes

MsSqlHook

Interact with Microsoft SQL Server.

Module Contents

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

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]
schema[source]
property sqlalchemy_scheme: str[source]

Sqlalchemy scheme either from constructor, connection extras or default.

property dialect_name: str[source]
property dialect: airflow.providers.common.sql.dialects.dialect.Dialect[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_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.

get_openlineage_database_info(connection)[source]

Return MSSQL specific information for OpenLineage.

get_openlineage_database_dialect(connection)[source]

Return database dialect.

get_openlineage_default_schema()[source]

Return current schema.

Was this entry helpful?