You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/06/22 19:25:24 UTC
[airflow] 46/47: Remove limitation for elasticsearch library
(#16553)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v2-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 60134d1339f8d4de9a455476810dafa227c303c6
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Tue Jun 22 08:05:44 2021 +0200
Remove limitation for elasticsearch library (#16553)
* Remove limitation for elasticsearch library
Elasticsearch <7.6.0 does not work with Python 3.9 (import
errors on deprecated base64 functionality that have been removed
in Python 3.9) see:
ihttps://bugzilla.redhat.com/show_bug.cgi?id=1894188
This PR bumps elasticsearch library version to latest available
(7.13.1 as of this writing) in order to get it Python 3.9
compatible.
(cherry picked from commit e5e59b479fc862406511468bfeee47897c44143b)
---
setup.py | 4 ++--
.../log/elasticmock/fake_elasticsearch.py | 26 +++++++++++++++++-----
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/setup.py b/setup.py
index cad6fc3..cefc104 100644
--- a/setup.py
+++ b/setup.py
@@ -275,8 +275,8 @@ druid = [
'pydruid>=0.4.1',
]
elasticsearch = [
- 'elasticsearch>7, <7.6.0',
- 'elasticsearch-dbapi==0.1.0',
+ 'elasticsearch>7',
+ 'elasticsearch-dbapi',
'elasticsearch-dsl>=5.0.0',
]
exasol = [
diff --git a/tests/providers/elasticsearch/log/elasticmock/fake_elasticsearch.py b/tests/providers/elasticsearch/log/elasticmock/fake_elasticsearch.py
index 2121972..4d6902a 100644
--- a/tests/providers/elasticsearch/log/elasticmock/fake_elasticsearch.py
+++ b/tests/providers/elasticsearch/log/elasticmock/fake_elasticsearch.py
@@ -88,7 +88,7 @@ class FakeElasticsearch(Elasticsearch):
'version',
'version_type',
)
- def index(self, index, doc_type, body, id=None, params=None):
+ def index(self, index, doc_type, body, id=None, params=None, headers=None):
if index not in self.__documents_dict:
self.__documents_dict[index] = []
@@ -98,10 +98,24 @@ class FakeElasticsearch(Elasticsearch):
version = 1
self.__documents_dict[index].append(
- {'_type': doc_type, '_id': id, '_source': body, '_index': index, '_version': version}
+ {
+ '_type': doc_type,
+ '_id': id,
+ '_source': body,
+ '_index': index,
+ '_version': version,
+ '_headers': headers,
+ }
)
- return {'_type': doc_type, '_id': id, 'created': True, '_version': version, '_index': index}
+ return {
+ '_type': doc_type,
+ '_id': id,
+ 'created': True,
+ '_version': version,
+ '_index': index,
+ '_headers': headers,
+ }
@query_params('parent', 'preference', 'realtime', 'refresh', 'routing')
def exists(self, index, doc_type, id, params=None):
@@ -198,7 +212,7 @@ class FakeElasticsearch(Elasticsearch):
'track_scores',
'version',
)
- def count(self, index=None, doc_type=None, body=None, params=None):
+ def count(self, index=None, doc_type=None, body=None, params=None, headers=None):
searchable_indexes = self._normalize_index_to_list(index)
searchable_doc_types = self._normalize_doc_type_to_list(doc_type)
@@ -247,7 +261,7 @@ class FakeElasticsearch(Elasticsearch):
'track_scores',
'version',
)
- def search(self, index=None, doc_type=None, body=None, params=None):
+ def search(self, index=None, doc_type=None, body=None, params=None, headers=None):
searchable_indexes = self._normalize_index_to_list(index)
matches = self._find_match(index, doc_type, body)
@@ -275,7 +289,7 @@ class FakeElasticsearch(Elasticsearch):
@query_params(
'consistency', 'parent', 'refresh', 'replication', 'routing', 'timeout', 'version', 'version_type'
)
- def delete(self, index, doc_type, id, params=None):
+ def delete(self, index, doc_type, id, params=None, headers=None):
found = False