Skip to content

Conversation

@Owen-CH-Leung
Copy link
Contributor

Fixes #41486

The current ElasticsearchSQLHook is not working since it is still using elasticsearch-dbapi which has already been deprecated last year. This PR fixes the issue by adding a execute_sql API, which simply forwards the SQL query to the underlying official elasticsearch client.

Docs are also updated to show a working example of ElasticsearchSQLHook. A Screencap of the log output:

image

@eladkal
Copy link
Contributor

eladkal commented Aug 16, 2024

Static checks are failing :(

@Owen-CH-Leung
Copy link
Contributor Author

Owen-CH-Leung commented Aug 16, 2024

I think the 3 failing tests are Tests / Basic tests / Test Airflow release commands , Tests / Provider checks / Provider packages sdist build and install , Tests / Integration Tests / Integration Tests: mssql , which are not related to static check ?

Tests / Static checks, mypy, docs / Static checks is green

@Owen-CH-Leung Owen-CH-Leung marked this pull request as ready for review August 17, 2024 03:30
@eladkal eladkal merged commit 7622192 into apache:main Aug 17, 2024
Artuz37 pushed a commit to Artuz37/airflow that referenced this pull request Aug 19, 2024
romsharon98 pushed a commit to romsharon98/airflow that referenced this pull request Aug 20, 2024

from deprecated import deprecated
from elasticsearch import Elasticsearch
from elasticsearch.client import SqlClient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed...We should access the SQL client directly via es instance. I'll file a PR to fix it later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ElasticsearchSQLHook fails with AttributeError: __enter__

2 participants