airflow icon indicating copy to clipboard operation
airflow copied to clipboard

ElasticsearchSQLHook fails with AttributeError: __enter__

Open Pooort opened this issue 1 year ago • 4 comments

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

Debian GNU/Linux 12 (bookworm)

Deployment

Docker-Compose

Deployment details

No response

What happened

Documentation's usage example 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: AttributeError: __enter__

What you think should happen instead

No response

How to reproduce

Implement Documentation's usage example.

Anything else

No response

Are you willing to submit PR?

  • [ ] Yes I am willing to submit a PR!

Code of Conduct

Pooort avatar Jun 26 '24 04:06 Pooort

Since you mentioned you deploy with MWAA, are you interacting with elasticsearch or with opensearch?

eladkal avatar Jun 26 '24 09:06 eladkal

Since you mentioned you deploy with MWAA, are you interacting with elasticsearch or with opensearch?

Sorry. Docker-Compose.

With Elasticsearch.

Pooort avatar Jun 26 '24 12:06 Pooort

@Pooort a full stack trace and a ready to use dag for repro would help speed up a fix.

aritra24 avatar Jun 26 '24 17:06 aritra24

Yes. Lack of stack trace makes it impossible to help you.

potiuk avatar Jun 26 '24 18:06 potiuk

This issue has been automatically marked as stale because it has been open for 14 days with no response from the author. It will be closed in next 7 days if no further activity occurs from the issue author.

github-actions[bot] avatar Jul 12 '24 00:07 github-actions[bot]

This issue has been closed because it has not received response from the issue author.

github-actions[bot] avatar Jul 19 '24 01:07 github-actions[bot]