blob: 302c00953b928e8187e94425fd643ee47d4aa889 [file] [log] [blame]
:mod:`airflow.hooks.druid_hook`
===============================
.. py:module:: airflow.hooks.druid_hook
Module Contents
---------------
.. py:class:: DruidHook(druid_ingest_conn_id='druid_ingest_default', timeout=1, max_ingestion_time=None)
Bases: :class:`airflow.hooks.base_hook.BaseHook`
Connection to Druid overlord for ingestion
To connect to a Druid cluster that is secured with the druid-basic-security
extension, add the username and password to the druid ingestion connection.
:param druid_ingest_conn_id: The connection id to the Druid overlord machine
which accepts index jobs
:type druid_ingest_conn_id: str
:param timeout: The interval between polling
the Druid job for the status of the ingestion job.
Must be greater than or equal to 1
:type timeout: int
:param max_ingestion_time: The maximum ingestion time before assuming the job failed
:type max_ingestion_time: int
.. method:: get_conn_url(self)
.. method:: get_auth(self)
Return username and password from connections tab as requests.auth.HTTPBasicAuth object.
If these details have not been set then returns None.
.. method:: submit_indexing_job(self, json_index_spec)
.. py:class:: DruidDbApiHook(*args, **kwargs)
Bases: :class:`airflow.hooks.dbapi_hook.DbApiHook`
Interact with Druid broker
This hook is purely for users to query druid broker.
For ingestion, please use druidHook.
.. attribute:: conn_name_attr
:annotation: = druid_broker_conn_id
.. attribute:: default_conn_name
:annotation: = druid_broker_default
.. attribute:: supports_autocommit
:annotation: = False
.. method:: get_conn(self)
Establish a connection to druid broker.
.. method:: get_uri(self)
Get the connection uri for druid broker.
e.g: druid://localhost:8082/druid/v2/sql/
.. method:: set_autocommit(self, conn, autocommit)
.. method:: insert_rows(self, table, rows, target_fields=None, commit_every=1000)