blob: dc516790ad5baea56e0e1ebd188aa9115a002667 [file] [log] [blame]
:mod:`airflow.hooks.base_hook`
==============================
.. py:module:: airflow.hooks.base_hook
.. autoapi-nested-parse::
Base class for all hooks
Module Contents
---------------
.. data:: CONN_ENV_PREFIX
:annotation: = AIRFLOW_CONN_
.. data:: log
.. py:class:: BaseHook(source)
Bases: :class:`airflow.utils.log.logging_mixin.LoggingMixin`
Abstract base class for hooks, hooks are meant as an interface to
interact with external systems. MySqlHook, HiveHook, PigHook return
object that can handle the connection and interaction to specific
instances of these systems, and expose consistent methods to interact
with them.
.. classmethod:: _get_connections_from_db(cls, conn_id, session=None)
.. classmethod:: _get_connection_from_env(cls, conn_id)
.. classmethod:: get_connections(cls, conn_id)
Get all connections as an iterable.
:param conn_id: connection id
:return: array of connections
.. classmethod:: get_connection(cls, conn_id)
.. classmethod:: get_hook(cls, conn_id)
.. method:: get_conn(self)
.. method:: get_records(self, sql)
.. method:: get_pandas_df(self, sql)
.. method:: run(self, sql)