Pooort opened a new issue, #41486:
URL: https://github.com/apache/airflow/issues/41486

   ### Apache Airflow Provider(s)
   
   elasticsearch
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-common-io==1.3.2
   apache-airflow-providers-common-sql==1.14.0
   apache-airflow-providers-elasticsearch==5.4.1
   apache-airflow-providers-fab==1.1.1
   apache-airflow-providers-ftp==3.9.1
   apache-airflow-providers-http==4.11.1
   apache-airflow-providers-imap==3.6.1
   apache-airflow-providers-smtp==1.7.1
   apache-airflow-providers-sqlite==3.8.1
   
   ### Apache Airflow version
   
   v2.9.2
   
   ### Operating System
   
   v2.9.2
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _No response_
   
   ### What happened
   
   [Documentation's usage 
example](https://airflow.apache.org/docs/apache-airflow-providers-elasticsearch/5.4.1/hooks/elasticsearch_sql_hook.html)
 for ElasticsearchSQLHook:
   ```
       es = ElasticsearchSQLHook(elasticsearch_conn_id=CONN_ID)
   
       # Handle ES conn with context manager
       with es.get_conn() as es_conn:
           tables = es_conn.execute("SHOW TABLES")
           for table, *_ in tables:
               print(f"table: {table}")
       return True
   ```
   fails with:
   ```
   Traceback (most recent call last):
     File 
"/snap/pycharm-professional/327/plugins/python/helpers/pydev/pydevd.py", line 
1496, in _exec
       pydev_imports.execfile(file, globals, locals)  # execute the script
     File 
"/snap/pycharm-professional/327/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py",
 line 18, in execfile
       exec(compile(contents+"\n", file, 'exec'), glob, loc)
     File "/home/test/projects/Test/airflow/new_test.py", line 17, in <module>
       with es.get_conn() as es_conn:
   AttributeError: __enter__
   ```
   
   ### What you think should happen instead
   
   _No response_
   
   ### How to reproduce
   
   Implement [Documentation's usage 
example](https://airflow.apache.org/docs/apache-airflow-providers-elasticsearch/5.4.1/hooks/elasticsearch_sql_hook.html).
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to