| :py:mod:`airflow.providers.influxdb.hooks.influxdb` |
| =================================================== |
| |
| .. py:module:: airflow.providers.influxdb.hooks.influxdb |
| |
| .. autoapi-nested-parse:: |
| |
| This module allows to connect to a InfluxDB database. |
| |
| .. spelling:: |
| |
| FluxTable |
| |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.influxdb.hooks.influxdb.InfluxDBHook |
| |
| |
| |
| |
| .. py:class:: InfluxDBHook(conn_id = default_conn_name, *args, **kwargs) |
| |
| Bases: :py:obj:`airflow.hooks.base.BaseHook` |
| |
| Interact with InfluxDB. |
| |
| Performs a connection to InfluxDB and retrieves client. |
| |
| :param influxdb_conn_id: Reference to :ref:`Influxdb connection id <howto/connection:influxdb>`. |
| |
| .. py:attribute:: conn_name_attr |
| :annotation: = influxdb_conn_id |
| |
| |
| |
| .. py:attribute:: default_conn_name |
| :annotation: = influxdb_default |
| |
| |
| |
| .. py:attribute:: conn_type |
| :annotation: = influxdb |
| |
| |
| |
| .. py:attribute:: hook_name |
| :annotation: = Influxdb |
| |
| |
| |
| .. py:method:: get_client(self, uri, token, org_name) |
| |
| |
| .. py:method:: get_uri(self, conn) |
| |
| Function to add additional parameters to the URI |
| based on SSL or other InfluxDB host requirements |
| |
| |
| |
| .. py:method:: get_conn(self) |
| |
| Function that initiates a new InfluxDB connection |
| with token and organization name |
| |
| |
| .. py:method:: query(self, query) |
| |
| Function to to run the query. |
| Note: The bucket name |
| should be included in the query |
| |
| :param query: InfluxDB query |
| :return: List |
| |
| |
| .. py:method:: query_to_df(self, query) |
| |
| Function to run the query and |
| return a pandas dataframe |
| Note: The bucket name |
| should be included in the query |
| |
| :param query: InfluxDB query |
| :return: pd.DataFrame |
| |
| |
| .. py:method:: write(self, bucket_name, point_name, tag_name, tag_value, field_name, field_value, synchronous=False) |
| |
| Writes a Point to the bucket specified. |
| Example: Point("my_measurement").tag("location", "Prague").field("temperature", 25.3) |
| |
| |
| .. py:method:: create_organization(self, name) |
| |
| Function to create a new organization |
| |
| |
| .. py:method:: delete_organization(self, org_id) |
| |
| Function to delete organization by organization id |
| |
| |
| .. py:method:: create_bucket(self, bucket_name, description, org_id, retention_rules=None) |
| |
| Function to create a bucket for an organization |
| |
| |
| .. py:method:: find_bucket_id_by_name(self, bucket_name) |
| |
| Function to get bucket id by name. |
| |
| |
| .. py:method:: delete_bucket(self, bucket_name) |
| |
| Function to delete bucket by bucket name. |
| |
| |
| |