airflow.providers.odbc.hooks.odbc
¶
This module contains ODBC hook.
Module Contents¶
Classes¶
Interact with odbc data sources using pyodbc. |
- class airflow.providers.odbc.hooks.odbc.OdbcHook(*args, database=None, driver=None, dsn=None, connect_kwargs=None, sqlalchemy_scheme=None, **kwargs)[source]¶
Bases:
airflow.providers.common.sql.hooks.sql.DbApiHook
Interact with odbc data sources using pyodbc.
See ODBC Connection for full documentation.
- property database: str | None[source]¶
Database provided in init if exists; otherwise,
schema
fromConnection
object.
- property sqlalchemy_scheme: str[source]¶
Sqlalchemy scheme either from constructor, connection extras or default.
- property connection_extra_lower: dict[source]¶
connection.extra_dejson
but where keys are converted to lower case.This is used internally for case-insensitive access of odbc params.
- property driver: str | None[source]¶
Driver from init param if given; else try to find one in connection extra.
- property dsn: str | None[source]¶
DSN from init param if given; else try to find one in connection extra.
- property odbc_connection_string[source]¶
ODBC connection string We build connection string instead of using
pyodbc.connect
params because, for example, there is no param representingApplicationIntent=ReadOnly
. Any key-value pairs provided inConnection.extra
will be added to the connection string.
- property connect_kwargs: dict[source]¶
Returns effective kwargs to be passed to
pyodbc.connect
after merging between conn extra,connect_kwargs
and hook init.Hook
connect_kwargs
precedesconnect_kwargs
from conn extra.If
attrs_before
provided, keys and values are converted to int, as required by pyodbc.
- get_uri()[source]¶
URI invoked in
get_sqlalchemy_engine()
method.