You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/08/20 09:02:38 UTC

[GitHub] [airflow] subkanthi opened a new pull request #17068: Influxdb Hook

subkanthi opened a new pull request #17068:
URL: https://github.com/apache/airflow/pull/17068


   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #14168
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   **^ Added influxdb hook to perform operations on InfluxDB 2 using python library **
   closes: #14168
   
   
   ---
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r685554071



##########
File path: airflow/providers/influxdb/example_dags/example_influxdb.py
##########
@@ -0,0 +1,57 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from airflow.models.dag import DAG
+from airflow.operators.python import PythonOperator
+from airflow.providers.influxdb.hooks.influxdb import InfluxDBHook
+from airflow.utils.dates import days_ago
+
+
+def test_influxdb_hook():

Review comment:
       Fixed.

##########
File path: airflow/providers/influxdb/hooks/influxdb.py
##########
@@ -0,0 +1,166 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""This module allows to connect to a InfluxDB database."""
+
+from typing import List
+
+import pandas as pd
+from influxdb_client import InfluxDBClient
+from influxdb_client.client.flux_table import FluxTable
+from influxdb_client.client.write.point import Point
+from influxdb_client.client.write_api import SYNCHRONOUS
+
+from airflow.hooks.base import BaseHook
+from airflow.models import Connection
+
+
+class InfluxDBHook(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>`.
+    :type influxdb_conn_id: str
+    """
+
+    conn_name_attr = 'influxdb_conn_id'
+    default_conn_name = 'influxdb_default'
+    conn_type = 'influxdb'
+    hook_name = 'Influxdb'
+
+    def __init__(self, conn_id: str = default_conn_name, *args, **kwargs) -> None:
+        super().__init__(*args, **kwargs)
+        self.influxdb_conn_id = conn_id
+        self.connection = kwargs.pop("connection", None)
+        self.client = None
+        self.extras = None
+        self.uri = None
+        self.org_name = None
+
+    def get_client(self, uri, token, org_name):
+        return InfluxDBClient(url=uri, token=token, org=org_name)
+
+    def get_uri(self, conn: Connection):
+        """
+        Function to add additional parameters to the URI
+        based on SSL or other InfluxDB host requirements
+
+        """
+        return '{scheme}://{host}:{port}'.format(
+            scheme='https' if conn.schema is None else f'{conn.schema}',

Review comment:
       Removed f for conn.schema




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-925354048


   OK. I merged the change for azure, Just rebase now + add pandas to influx extra. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-925290407


   > > It looks much better than before, failing ones seem to azure related.
   > 
   > It's probably due to [Azure/azure-sdk-for-python#18801](https://github.com/Azure/azure-sdk-for-python/pull/18801)
   > 
   > Static failures needs to be addressed. we probably need to limit `azure-storage-blob` to < 12.9.0 in a separate PR
   
   Yep. That's what we discussed in slack. I will make that PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-929652763


   πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r705740566



##########
File path: airflow/providers/influxdb/example_dags/example_influxdb.py
##########
@@ -0,0 +1,57 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       Thanks @eladkal , added and rebased again, fingers crossed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-922355542


   Close/Reopen to rebuild


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r706621763



##########
File path: docs/apache-airflow-providers-influxdb/operators/influxdb.rst
##########
@@ -0,0 +1,23 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _howto/operator:InfluxDBOperator:
+
+InfluxDBOperator
+=================
+
+Not Implemented.

Review comment:
       There was a build docs error, if this wasnt added.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
eladkal commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r714259771



##########
File path: airflow/providers/influxdb/hooks/influxdb.py
##########
@@ -0,0 +1,163 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""This module allows to connect to a InfluxDB database."""
+
+from typing import List
+
+import pandas as pd

Review comment:
       mmm this provider must have `pandas` yet pandas is now an optional dependency in Airflow core https://github.com/apache/airflow/pull/17575
   shouldn't we wrap it with try catch and raising exception if pandas is not installed?
   @potiuk WDYT?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
uranusjr commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r681427401



##########
File path: airflow/providers/influxdb/hooks/influxdb.py
##########
@@ -0,0 +1,166 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""This module allows to connect to a InfluxDB database."""
+
+from typing import List
+
+import pandas as pd
+from influxdb_client import InfluxDBClient
+from influxdb_client.client.flux_table import FluxTable
+from influxdb_client.client.write.point import Point
+from influxdb_client.client.write_api import SYNCHRONOUS
+
+from airflow.hooks.base import BaseHook
+from airflow.models import Connection
+
+
+class InfluxDBHook(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>`.
+    :type influxdb_conn_id: str
+    """
+
+    conn_name_attr = 'influxdb_conn_id'
+    default_conn_name = 'influxdb_default'
+    conn_type = 'influxdb'
+    hook_name = 'Influxdb'
+
+    def __init__(self, conn_id: str = default_conn_name, *args, **kwargs) -> None:
+        super().__init__(*args, **kwargs)
+        self.influxdb_conn_id = conn_id
+        self.connection = kwargs.pop("connection", None)
+        self.client = None
+        self.extras = None
+        self.uri = None
+        self.org_name = None
+
+    def get_client(self, uri, token, org_name):
+        return InfluxDBClient(url=uri, token=token, org=org_name)
+
+    def get_uri(self, conn: Connection):
+        """
+        Function to add additional parameters to the URI
+        based on SSL or other InfluxDB host requirements
+
+        """
+        return '{scheme}://{host}:{port}'.format(
+            scheme='https' if conn.schema is None else f'{conn.schema}',
+            host=conn.host,
+            port='7687' if conn.port is None else f'{conn.port}',
+        )
+
+    def get_conn(self) -> InfluxDBClient:
+        """
+        Function that initiates a new InfluxDB connection
+        with token and organization name
+        """
+        self.connection = self.get_connection(self.influxdb_conn_id)
+        self.extras = self.connection.extra_dejson.copy()
+
+        self.uri = self.get_uri(self.connection)
+        self.log.info('URI: %s', self.uri)
+
+        if self.client is not None:
+            return self.client
+
+        token = self.connection.extra_dejson.get('token')
+        self.org_name = self.connection.extra_dejson.get('org_name')
+
+        self.log.info('URI: %s', self.uri)
+        self.log.info('Organization: %s', self.org_name)
+
+        self.client = self.get_client(self.uri, token, self.org_name)
+
+        return self.client
+
+    def query(self, query) -> List[FluxTable]:
+        """
+        Function to use the query_api
+        to run the query.
+        Note: The bucket name
+        should be included in the query
+        'from(bucket:"my-bucket") |> range(start: -10m)'
+
+        :param query: InfluxDB query
+        :return: List[FluxTable]
+        """
+        client = self.get_conn()
+
+        query_api = client.query_api()
+        return query_api.query(query)
+
+    def query_with_df(self, query) -> pd.DataFrame:

Review comment:
       ```suggestion
       def query_to_df(self, query) -> pd.DataFrame:
   ```
   
   β€œWith” to me means `query` is a dataframe, not the return value.
   
   (`query_df` or `query_data_frame` like how the Influx DB client calls it is fine as well.)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr closed pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
uranusjr closed pull request #17068:
URL: https://github.com/apache/airflow/pull/17068


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk closed pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk closed pull request #17068:
URL: https://github.com/apache/airflow/pull/17068


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk merged pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #17068:
URL: https://github.com/apache/airflow/pull/17068


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-916849947


   Found the problem. Fix is coming. I am not sure how it was triggered now but was not triggered before. Tableau test package misses ``_init_.py` simply ... I will add it together with some protection to check for `__init__.py` also in `tests` - we already have it for "airflow.providers" - but we do not have it for `tests.providers` :(


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-916869739


   Sorry for that @subkanthi ... That was somewhat unexpected :(


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] rsingh2411 commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
rsingh2411 commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-924857477


   @potiuk  any timelines for this feature , which release will be it part of.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-925362743


   > OK. I merged the change for azure, Just rebase now + add pandas to influx extra.
   
   Thanks @potiuk , will do now


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-917046569


   One more missing ``__init__.py`` - now I  think I know where it could come from. Lack of __init__.py creates an implicit namespace and the problem was that from influxdb tests (in their own namespace) through some chain of imports the tests tried to load the "tableau"  and then they were in two separate namespaces and could not see each other.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-891799985


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
uranusjr commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r684911389



##########
File path: tests/providers/influxdb/operators/test_influxDbHook.py
##########
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import unittest
+from unittest import mock
+
+from airflow.models import Connection
+from airflow.providers.influxdb.hooks.influxdb import InfluxDBHook
+
+
+class TestInfluxDbHookConn(unittest.TestCase):
+    def setUp(self):
+        super().setUp()
+        self.influxdb_hook = InfluxDBHook()
+        extra = {}
+        extra['token'] = '123456789'
+        extra['org_name'] = 'test'
+
+        self.connection = Connection(schema='http', host='localhost', extra=extra)
+
+    def test_get_conn(self):
+        self.influxdb_hook.get_connection = mock.Mock()
+        self.influxdb_hook.get_connection.return_value = self.connection
+
+        self.influxdb_hook.get_client = mock.Mock()

Review comment:
       Would be nice to assert some calls on these mocks as well.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-905734948


   > LGTM and heppy to merge as soon as as you rebase @subkanthi - there were some unrelated errors in main (fixed since then). Can you please rebase?
   
   @potiuk , The docs are fixed now. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-916933565


   OK. You can rebase (again :( @subkanthi )  - the fix to missing ``__init__.py` is merged. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r706621763



##########
File path: docs/apache-airflow-providers-influxdb/operators/influxdb.rst
##########
@@ -0,0 +1,23 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _howto/operator:InfluxDBOperator:
+
+InfluxDBOperator
+=================
+
+Not Implemented.

Review comment:
       There was a build docs error, if this wasnt added. Let me try again, the problem is somehow Im not able to reproduce doc errors that happen in the CI server locally, but its got better




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
eladkal commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r706607979



##########
File path: docs/apache-airflow-providers-influxdb/operators/influxdb.rst
##########
@@ -0,0 +1,23 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _howto/operator:InfluxDBOperator:
+
+InfluxDBOperator
+=================
+
+Not Implemented.

Review comment:
       Why do we need this if not implemented? I assume you added it because of the how-to-guide in the `provider.yaml` ? you can remove the `how-to-guide` from the yaml as there is no content here.

##########
File path: tests/providers/influxdb/operators/test_influxDbHook.py
##########
@@ -0,0 +1,48 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       This file name and path is wrong. This PR introduce only hook so it should not be in `/operators`
   The path should be:
   `tests/providers/influxdb/hooks/test_influxdb.py` (note you will also need to change the `__init__`)
   
   also you only tested the connection. the  hook contains functions `query`/`create_organization`/`find_bucket_id_by_name` and others that have no testing. is this intentional? 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-884603604


   > * InfluxDB
   
   Thanks @uranusjr , Removed README and fixed the influxdb case in provider.yaml


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk merged pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #17068:
URL: https://github.com/apache/airflow/pull/17068


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r708776531



##########
File path: tests/providers/influxdb/hooks/test_influxDbHook.py
##########
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       Added unit tests, @eladkal , thanks




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk edited a comment on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk edited a comment on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-916849947


   Found the problem. Fix is coming. I am not sure how it was triggered now but was not triggered before. Tableau test package misses `_init_.py` simply ... I will add it together with some protection to check for `__init__.py` also in `tests` - we already have it for "airflow.providers" - but we do not have it for `tests.providers` :(


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-916868864


   Fix here: https://github.com/apache/airflow/pull/18142 (there were quite a few missing ``__init__.py` files. Stil do not what triggered the error though (and did not trigger it before)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r706629474



##########
File path: tests/providers/influxdb/operators/test_influxDbHook.py
##########
@@ -0,0 +1,48 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       Thanks, will move it to hooks, some of the functions are simple wrappers, but I can add tests for two functions(write and find_bucket_id_by_name)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-929639472


   > Hey @subkanthi - one LAST rebase please. I think it should be good to go - maybe you can also squash all commits ?
   
   Hi @potiuk , did a rebase, please let me know if its fine.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-891293072


   @uranusjr ?:)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r714271707



##########
File path: airflow/providers/influxdb/hooks/influxdb.py
##########
@@ -0,0 +1,163 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""This module allows to connect to a InfluxDB database."""
+
+from typing import List
+
+import pandas as pd

Review comment:
       Good catch. I think It's better to get influx db extra to depend on pandas directly (with 'pandas>=0.17.1, <2.0`  - Ok with that @kanthi? 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
eladkal commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r718203228



##########
File path: docs/apache-airflow-providers-influxdb/operators/influxdb.rst
##########
@@ -0,0 +1,23 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _howto/operator:InfluxDBOperator:
+
+InfluxDBOperator
+=================
+
+Not Implemented.

Review comment:
       @subkanthi Now that this is merged I think it a nice followup task would be to add `InfluxDBOperator`  around query function of the hook. It seems very simple and probably useful it will also help to add some content into this rst :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-929652763


   πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ πŸŽ‰ 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-916117541


   > @subkanthi can you rebase? there are failures on `test_current_user_has_permissions` which were fixed on main
   
   @eladkal Thanks rebased from master


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-916841729


   also @uranusjr -> for the future ^^ - for similar investigations, you might not be aware of it but we have full reproducibility of the images used during tests locally (the command is printed in the logs)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-929639472


   > Hey @subkanthi - one LAST rebase please. I think it should be good to go - maybe you can also squash all commits ?
   
   Hi @potiuk , did a rebase, please let me know if its fine.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-925256322


   > 🀞
   
   It looks much better than before, failing ones seem to azure related.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r708776531



##########
File path: tests/providers/influxdb/hooks/test_influxDbHook.py
##########
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       Fixed and added more tests, @eladkal , thanks




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r706629474



##########
File path: tests/providers/influxdb/operators/test_influxDbHook.py
##########
@@ -0,0 +1,48 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       Thanks, will move it to hooks, some of the functions are simple wrappers, but I can added test two functions(write and find_bucket_id_by_name)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
eladkal commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r696501018



##########
File path: airflow/providers/influxdb/provider.yaml
##########
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+---
+package-name: apache-airflow-providers-influxdb
+name: Influxdb
+description: |
+    `InfluxDB <https://www.influxdata.com/>`__
+versions:
+  - 1.0.0
+integrations:
+  - integration-name: Influxdb
+    external-doc-url: https://www.influxdata.com/
+    how-to-guide:
+      - /docs/apache-airflow-providers-influxdb/operators/influxdb.rst
+    tags: [software]
+
+hooks:
+  - integration-name: Influxdb
+    python-modules:
+      - airflow.providers.influxdb.hooks.influxdb
+
+hook-class-names:
+  - airflow.providers.influxdb.hooks.influxdb.InfluxDBHook

Review comment:
       You have a test failure related to these lines:
   ```
     =================================== FAILURES ===================================
     _____________________ TestProviderManager.test_hook_values _____________________
     
     self = <test_providers_manager.TestProviderManager testMethod=test_hook_values>
     
         def test_hook_values(self):
             with pytest.warns(expected_warning=None) as warning_records:
                 with self._caplog.at_level(logging.WARNING):
                     provider_manager = ProvidersManager()
                     connections_list = list(provider_manager.hooks.values())
                     assert len(connections_list) > 60
     >       assert [] == [w.message for w in warning_records.list if "hook-class-names" in str(w.message)]
     E       AssertionError: assert [] == [DeprecationW...rflow < 2.2")]
     E         Right contains one more item: DeprecationWarning("The provider apache-airflow-providers-influxdb uses `hook-class-names` property in provider-info a...f 'connection-types' in Airflow 2.2. Use **both** in case you want to have backwards compatibility with Airflow < 2.2")
     E         Use -v to get the full diff
     
     tests/core/test_providers_manager.py:132: AssertionError
   ```
   
   You need to add also `connection-types` see https://github.com/apache/airflow/pull/17682




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-916840245


   There is indeed something fishy going on here with test collection. I am taking a look, 
   
   BTW (for the future @eladkal @subkanthi ) - if you look at the logs, it is super easy to reproduce the very exact image/environment that was used during the build - in such cases it is really helpful.
   
   ```
    ./breeze --github-image-id 63d117d2fed6c0e9bfcfb09468fae347a944f03b --backend mssql --python 3.7 --db-reset --skip-mounting-local-sources --test-type Providers shell
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r696566007



##########
File path: airflow/providers/influxdb/provider.yaml
##########
@@ -0,0 +1,38 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+---
+package-name: apache-airflow-providers-influxdb
+name: Influxdb
+description: |
+    `InfluxDB <https://www.influxdata.com/>`__
+versions:
+  - 1.0.0
+integrations:
+  - integration-name: Influxdb
+    external-doc-url: https://www.influxdata.com/
+    how-to-guide:
+      - /docs/apache-airflow-providers-influxdb/operators/influxdb.rst
+    tags: [software]
+
+hooks:
+  - integration-name: Influxdb
+    python-modules:
+      - airflow.providers.influxdb.hooks.influxdb
+
+hook-class-names:
+  - airflow.providers.influxdb.hooks.influxdb.InfluxDBHook

Review comment:
       Glad that I added the test then :).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
eladkal commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r705587619



##########
File path: airflow/providers/influxdb/example_dags/example_influxdb.py
##########
@@ -0,0 +1,57 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       please add `__init__` to `example_dags`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-902371051


   > LGTM and heppy to merge as soon as as you rebase @subkanthi - there were some unrelated errors in main (fixed since then). Can you please rebase?
   
   Thanks @potiuk for looking at it again, rebased.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
eladkal commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r718203228



##########
File path: docs/apache-airflow-providers-influxdb/operators/influxdb.rst
##########
@@ -0,0 +1,23 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _howto/operator:InfluxDBOperator:
+
+InfluxDBOperator
+=================
+
+Not Implemented.

Review comment:
       @subkanthi Now that this is merged I think it a nice followup task would be to add `InfluxDBOperator`  around `query` function of the hook. It seems very simple and probably useful it will also help to add some content into this rst :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
eladkal commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-915966341


   @subkanthi can you rebase? there are failures on `test_current_user_has_permissions` which were fixed on main


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-926882587


   Hey @subkanthi - one LAST rebase please. I think it should be good to go - maybe you can also squash all commits ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-917374764


   Looks like only intermittent errors! Finally!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
eladkal commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-925264410


   > It looks much better than before, failing ones seem to azure related.
   
   It's probably due to https://github.com/Azure/azure-sdk-for-python/pull/18801
   
   Static failures needs to be addressed. we probably need to limit `azure-storage-blob` to < 12.9.0 in a separate PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-925235515


   🀞 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-917374824


   Hey @eladkal  - I am ready to merge that one :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
eladkal commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r706635048



##########
File path: tests/providers/influxdb/hooks/test_influxDbHook.py
##########
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       You missed the rename of the file from `test_influxDBHook.py` to `test_influxdb.py`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-917153258


   The only 'real' failure is build docs now :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-916946644


   > Sorry for that @subkanthi ... That was somewhat unexpected :(
   
   No worries, thanks for helping out.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
uranusjr commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r684907749



##########
File path: airflow/providers/influxdb/example_dags/example_influxdb.py
##########
@@ -0,0 +1,57 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from airflow.models.dag import DAG
+from airflow.operators.python import PythonOperator
+from airflow.providers.influxdb.hooks.influxdb import InfluxDBHook
+from airflow.utils.dates import days_ago
+
+
+def test_influxdb_hook():

Review comment:
       Don’t name things with `test_`, this will be picked up by the test runner.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk closed pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk closed pull request #17068:
URL: https://github.com/apache/airflow/pull/17068


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r685554272



##########
File path: tests/providers/influxdb/operators/test_influxDbHook.py
##########
@@ -0,0 +1,43 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import unittest
+from unittest import mock
+
+from airflow.models import Connection
+from airflow.providers.influxdb.hooks.influxdb import InfluxDBHook
+
+
+class TestInfluxDbHookConn(unittest.TestCase):
+    def setUp(self):
+        super().setUp()
+        self.influxdb_hook = InfluxDBHook()
+        extra = {}
+        extra['token'] = '123456789'
+        extra['org_name'] = 'test'
+
+        self.connection = Connection(schema='http', host='localhost', extra=extra)
+
+    def test_get_conn(self):
+        self.influxdb_hook.get_connection = mock.Mock()
+        self.influxdb_hook.get_connection.return_value = self.connection
+
+        self.influxdb_hook.get_client = mock.Mock()

Review comment:
       Added asserts. Thanks




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] eladkal commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
eladkal commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r718203228



##########
File path: docs/apache-airflow-providers-influxdb/operators/influxdb.rst
##########
@@ -0,0 +1,23 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _howto/operator:InfluxDBOperator:
+
+InfluxDBOperator
+=================
+
+Not Implemented.

Review comment:
       @subkanthi Now that this is merged I think it a nice followup task would be to add `InfluxDBOperator`  around query function of the hook. It seems very simple and probably useful it will also help to add some content into this rst :)

##########
File path: docs/apache-airflow-providers-influxdb/operators/influxdb.rst
##########
@@ -0,0 +1,23 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+.. _howto/operator:InfluxDBOperator:
+
+InfluxDBOperator
+=================
+
+Not Implemented.

Review comment:
       @subkanthi Now that this is merged I think it a nice followup task would be to add `InfluxDBOperator`  around `query` function of the hook. It seems very simple and probably useful it will also help to add some content into this rst :)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] subkanthi commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
subkanthi commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r714406661



##########
File path: airflow/providers/influxdb/hooks/influxdb.py
##########
@@ -0,0 +1,163 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""This module allows to connect to a InfluxDB database."""
+
+from typing import List
+
+import pandas as pd

Review comment:
       Thanks, added in setup.py




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-925295242


   https://github.com/apache/airflow/pull/18443 @subkanthi -  once this is merged you can rebase with additional pandas deps and 🀞 it will be good to merge.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#issuecomment-925074482


   It's gone come in September wave of Providers ~ 1.5 week or so


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr commented on a change in pull request #17068: Influxdb Hook

Posted by GitBox <gi...@apache.org>.
uranusjr commented on a change in pull request #17068:
URL: https://github.com/apache/airflow/pull/17068#discussion_r684910691



##########
File path: airflow/providers/influxdb/hooks/influxdb.py
##########
@@ -0,0 +1,166 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""This module allows to connect to a InfluxDB database."""
+
+from typing import List
+
+import pandas as pd
+from influxdb_client import InfluxDBClient
+from influxdb_client.client.flux_table import FluxTable
+from influxdb_client.client.write.point import Point
+from influxdb_client.client.write_api import SYNCHRONOUS
+
+from airflow.hooks.base import BaseHook
+from airflow.models import Connection
+
+
+class InfluxDBHook(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>`.
+    :type influxdb_conn_id: str
+    """
+
+    conn_name_attr = 'influxdb_conn_id'
+    default_conn_name = 'influxdb_default'
+    conn_type = 'influxdb'
+    hook_name = 'Influxdb'
+
+    def __init__(self, conn_id: str = default_conn_name, *args, **kwargs) -> None:
+        super().__init__(*args, **kwargs)
+        self.influxdb_conn_id = conn_id
+        self.connection = kwargs.pop("connection", None)
+        self.client = None
+        self.extras = None
+        self.uri = None
+        self.org_name = None
+
+    def get_client(self, uri, token, org_name):
+        return InfluxDBClient(url=uri, token=token, org=org_name)
+
+    def get_uri(self, conn: Connection):
+        """
+        Function to add additional parameters to the URI
+        based on SSL or other InfluxDB host requirements
+
+        """
+        return '{scheme}://{host}:{port}'.format(
+            scheme='https' if conn.schema is None else f'{conn.schema}',

Review comment:
       Is this `f""` needed? I think `conn.schema` is always a string here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org