| :py:mod:`airflow.providers.odbc.hooks.odbc` |
| =========================================== |
| |
| .. py:module:: airflow.providers.odbc.hooks.odbc |
| |
| .. autoapi-nested-parse:: |
| |
| This module contains ODBC hook. |
| |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.odbc.hooks.odbc.OdbcHook |
| |
| |
| |
| |
| .. py:class:: OdbcHook(*args, database = None, driver = None, dsn = None, connect_kwargs = None, sqlalchemy_scheme = None, **kwargs) |
| |
| Bases: :py:obj:`airflow.providers.common.sql.hooks.sql.DbApiHook` |
| |
| Interact with odbc data sources using pyodbc. |
| |
| See :doc:`/connections/odbc` for full documentation. |
| |
| .. py:attribute:: DEFAULT_SQLALCHEMY_SCHEME |
| :annotation: = mssql+pyodbc |
| |
| |
| |
| .. py:attribute:: conn_name_attr |
| :annotation: = odbc_conn_id |
| |
| |
| |
| .. py:attribute:: default_conn_name |
| :annotation: = odbc_default |
| |
| |
| |
| .. py:attribute:: conn_type |
| :annotation: = odbc |
| |
| |
| |
| .. py:attribute:: hook_name |
| :annotation: = ODBC |
| |
| |
| |
| .. py:attribute:: supports_autocommit |
| :annotation: = True |
| |
| |
| |
| .. py:method:: connection() |
| :property: |
| |
| ``airflow.Connection`` object with connection id ``odbc_conn_id`` |
| |
| |
| .. py:method:: database() |
| :property: |
| |
| Database provided in init if exists; otherwise, ``schema`` from ``Connection`` object. |
| |
| |
| .. py:method:: sqlalchemy_scheme() |
| :property: |
| |
| Sqlalchemy scheme either from constructor, connection extras or default. |
| |
| |
| .. py:method:: connection_extra_lower() |
| :property: |
| |
| ``connection.extra_dejson`` but where keys are converted to lower case. |
| |
| This is used internally for case-insensitive access of odbc params. |
| |
| |
| .. py:method:: driver() |
| :property: |
| |
| Driver from init param if given; else try to find one in connection extra. |
| |
| |
| .. py:method:: dsn() |
| :property: |
| |
| DSN from init param if given; else try to find one in connection extra. |
| |
| |
| .. py:method:: odbc_connection_string() |
| :property: |
| |
| ODBC connection string |
| We build connection string instead of using ``pyodbc.connect`` params because, for example, there is |
| no param representing ``ApplicationIntent=ReadOnly``. Any key-value pairs provided in |
| ``Connection.extra`` will be added to the connection string. |
| |
| |
| .. py:method:: connect_kwargs() |
| :property: |
| |
| Returns effective kwargs to be passed to ``pyodbc.connect`` after merging between conn extra, |
| ``connect_kwargs`` and hook init. |
| |
| Hook ``connect_kwargs`` precedes ``connect_kwargs`` from conn extra. |
| |
| If ``attrs_before`` provided, keys and values are converted to int, as required by pyodbc. |
| |
| |
| .. py:method:: get_conn() |
| |
| Returns a pyodbc connection object. |
| |
| |
| .. py:method:: get_uri() |
| |
| URI invoked in :py:meth:`~airflow.providers.common.sql.hooks.sql.DbApiHook.get_sqlalchemy_engine` |
| method. |
| |
| |
| .. py:method:: get_sqlalchemy_connection(connect_kwargs = None, engine_kwargs = None) |
| |
| Sqlalchemy connection object |
| |
| |
| |