eladkal commented on code in PR #24895:
URL: https://github.com/apache/airflow/pull/24895#discussion_r915693615
##########
tests/providers/elasticsearch/hooks/test_elasticsearch.py:
##########
@@ -20,8 +20,10 @@
import unittest
from unittest import mock
+from elasticsearch import Elasticsearch
+
from airflow.models import Connection
-from airflow.providers.elasticsearch.hooks.elasticsearch import
ElasticsearchHook
+from airflow.providers.elasticsearch.hooks.elasticsearch import
ElasticsearchHook, ElasticsearchPythonHook
Review Comment:
Please use the new class name on the import
##########
tests/system/providers/elasticsearch/example_elasticsearch_python_hook.py:
##########
@@ -0,0 +1,58 @@
+# Licensed to the Apache Software Foundation (ASF) under one
Review Comment:
Rename the file example_elasticsearch_hook.py ?
##########
airflow/providers/elasticsearch/hooks/elasticsearch.py:
##########
@@ -93,3 +95,53 @@ def get_uri(self) -> str:
uri += '&'
return uri
+
+
+class ElasticsearchHook(ElasticsearchSQLHook):
+ """
+ This class is deprecated and was renamed to ElasticsearchSQLHook.
+ Please use
`airflow.providers.elasticsearch.hooks.elasticsearch.ElasticsearchSQLHook`.
+ """
+
+ def __init__(self, *args, **kwargs):
+ warnings.warn(
+ """This class is deprecated.
+ Please use
`airflow.providers.elasticsearch.hooks.elasticsearch.ElasticsearchSQLHook`.""",
+ DeprecationWarning,
+ stacklevel=3,
+ )
+ super().__init__(*args, **kwargs)
+
+
+class ElasticsearchPythonHook(BaseHook):
+ """
+ Interacts with Elasticsearch. This hook uses the official Elasticsearch
Python Client.
+
+ :param hosts: list: A list of a single or many Elasticsearch instances.
Example: ["http://localhost:9200"]
+ :param es_conn_args: dict: Additional arguments you might need to enter to
connect to Elasticsearch.
+ Example: {"ca_cert":"/path/to/http_ca.crt",
"basic_auth": "(user, pass)"}
Review Comment:
It looks like we need also a connection.rst to explain this additional
settings for the connection
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]