python-databases 1.2.2__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_databases-1.2.2/python_databases.egg-info → python_databases-2.1.0}/PKG-INFO +6 -6
- {python_databases-1.2.2 → python_databases-2.1.0}/pyproject.toml +8 -10
- {python_databases-1.2.2 → python_databases-2.1.0}/python_databases/elasticsearch_infrastructure/elasticsearch.py +14 -20
- {python_databases-1.2.2 → python_databases-2.1.0/python_databases.egg-info}/PKG-INFO +6 -6
- python_databases-2.1.0/python_databases.egg-info/requires.txt +6 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/tests/test_elasticsearch.py +1 -1
- python_databases-1.2.2/python_databases.egg-info/requires.txt +0 -6
- {python_databases-1.2.2 → python_databases-2.1.0}/LICENSE +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/MANIFEST.in +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/README.md +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/python_databases/__init__.py +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/python_databases/consts.py +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/python_databases/elasticsearch_infrastructure/__init__.py +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/python_databases/elasticsearch_infrastructure/consts.py +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/python_databases/postgresql_infrastructure/__init__.py +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/python_databases/postgresql_infrastructure/consts.py +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/python_databases/postgresql_infrastructure/postgresql.py +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/python_databases.egg-info/SOURCES.txt +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/python_databases.egg-info/dependency_links.txt +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/python_databases.egg-info/top_level.txt +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/setup.cfg +0 -0
- {python_databases-1.2.2 → python_databases-2.1.0}/tests/test_postgres.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-databases
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: A Python library for managing and interacting with multiple databases seamlessly.
|
|
5
5
|
Author: Avi Zaguri
|
|
6
6
|
License: MIT
|
|
@@ -16,11 +16,11 @@ Classifier: Topic :: System :: Logging
|
|
|
16
16
|
Requires-Python: >=3.12
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: custom-python-logger>=4.
|
|
20
|
-
Requires-Dist: elasticsearch<9
|
|
21
|
-
Requires-Dist: pandas>=
|
|
22
|
-
Requires-Dist: psycopg2-binary>=2.9.
|
|
23
|
-
Requires-Dist: python-dotenv>=1.2.
|
|
19
|
+
Requires-Dist: custom-python-logger>=4.2.0
|
|
20
|
+
Requires-Dist: elasticsearch<9,>=8.19.3
|
|
21
|
+
Requires-Dist: pandas>=3.1.1
|
|
22
|
+
Requires-Dist: psycopg2-binary>=2.9.13
|
|
23
|
+
Requires-Dist: python-dotenv>=1.2.4
|
|
24
24
|
Requires-Dist: retrying>=1.4.2
|
|
25
25
|
Dynamic: license-file
|
|
26
26
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-databases"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "2.1.0"
|
|
8
8
|
description = "A Python library for managing and interacting with multiple databases seamlessly."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
@@ -21,20 +21,18 @@ classifiers = [
|
|
|
21
21
|
]
|
|
22
22
|
|
|
23
23
|
dependencies = [
|
|
24
|
-
"custom-python-logger>=4.
|
|
25
|
-
"elasticsearch
|
|
26
|
-
"pandas>=
|
|
27
|
-
"psycopg2-binary>=2.9.
|
|
28
|
-
"python-dotenv>=1.2.
|
|
24
|
+
"custom-python-logger>=4.2.0",
|
|
25
|
+
"elasticsearch>=8.19.3,<9",
|
|
26
|
+
"pandas>=3.1.1",
|
|
27
|
+
"psycopg2-binary>=2.9.13",
|
|
28
|
+
"python-dotenv>=1.2.4",
|
|
29
29
|
"retrying>=1.4.2",
|
|
30
30
|
]
|
|
31
31
|
|
|
32
32
|
[dependency-groups]
|
|
33
33
|
dev = [
|
|
34
|
-
"pre-commit>=4.
|
|
35
|
-
"pytest>=9.
|
|
36
|
-
"setuptools>=84.0.0",
|
|
37
|
-
"wheel>=0.48.0",
|
|
34
|
+
"pre-commit>=4.7.0",
|
|
35
|
+
"pytest>=9.2.0",
|
|
38
36
|
]
|
|
39
37
|
|
|
40
38
|
[project.urls]
|
|
@@ -38,10 +38,10 @@ class ElasticSearch(ABC):
|
|
|
38
38
|
self.password = password
|
|
39
39
|
|
|
40
40
|
self.elasticsearch_port = elasticsearch_port
|
|
41
|
-
if
|
|
42
|
-
self.elasticsearch_url = f"{self.protocol.value}://{self.elk_hostname}"
|
|
43
|
-
else:
|
|
41
|
+
if self.elasticsearch_port:
|
|
44
42
|
self.elasticsearch_url = f"{self.protocol.value}://{self.elk_hostname}:{self.elasticsearch_port}"
|
|
43
|
+
else:
|
|
44
|
+
self.elasticsearch_url = f"{self.protocol.value}://{self.elk_hostname}"
|
|
45
45
|
self.kibana_port = kibana_port
|
|
46
46
|
|
|
47
47
|
self.elk_client = None
|
|
@@ -67,7 +67,7 @@ class ElasticSearch(ABC):
|
|
|
67
67
|
):
|
|
68
68
|
for item in failed_response:
|
|
69
69
|
if item[1]["index"]["status"] != 201 or item[1]["index"]["_shards"]["failed"] > 0:
|
|
70
|
-
self.logger.
|
|
70
|
+
self.logger.error(f"Failed document: \n{item}")
|
|
71
71
|
failed_response_list.append(item)
|
|
72
72
|
if raise_on_error and failed_response_list:
|
|
73
73
|
raise Exception(f"Failed to report {len(failed_response_list)} documents to Elasticsearch")
|
|
@@ -89,7 +89,9 @@ class ElasticSearch(ABC):
|
|
|
89
89
|
|
|
90
90
|
if quick:
|
|
91
91
|
self._set_list_of_docs_quick(
|
|
92
|
-
list_of_docs=list_of_docs,
|
|
92
|
+
list_of_docs=list_of_docs,
|
|
93
|
+
request_timeout=request_timeout,
|
|
94
|
+
raise_on_error=raise_on_error,
|
|
93
95
|
)
|
|
94
96
|
else:
|
|
95
97
|
self._set_list_of_docs_safe(list_of_docs=list_of_docs)
|
|
@@ -97,23 +99,15 @@ class ElasticSearch(ABC):
|
|
|
97
99
|
|
|
98
100
|
@staticmethod
|
|
99
101
|
def _get_doc_with_basic_info() -> dict:
|
|
100
|
-
doc = {}
|
|
101
|
-
|
|
102
102
|
timestamp = datetime.now(tz=UTC)
|
|
103
103
|
date_and_time_str = timestamp.isoformat()
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"date_and_time_str": date_and_time_str,
|
|
112
|
-
"date_str": date,
|
|
113
|
-
"time_str": time_part,
|
|
114
|
-
}
|
|
115
|
-
)
|
|
116
|
-
return doc
|
|
104
|
+
return {
|
|
105
|
+
"doc_id": timestamp.strftime("%Y%m%dT%H%M%S%f"),
|
|
106
|
+
"upload_timestamp": timestamp,
|
|
107
|
+
"date_and_time_str": date_and_time_str,
|
|
108
|
+
"date_str": date_and_time_str.split("T")[0],
|
|
109
|
+
"time_str": date_and_time_str.split("T")[1].split("+")[0],
|
|
110
|
+
}
|
|
117
111
|
|
|
118
112
|
@staticmethod
|
|
119
113
|
def _add_list_values_as_str(doc: dict, column: str, value: Any) -> None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-databases
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: A Python library for managing and interacting with multiple databases seamlessly.
|
|
5
5
|
Author: Avi Zaguri
|
|
6
6
|
License: MIT
|
|
@@ -16,11 +16,11 @@ Classifier: Topic :: System :: Logging
|
|
|
16
16
|
Requires-Python: >=3.12
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: custom-python-logger>=4.
|
|
20
|
-
Requires-Dist: elasticsearch<9
|
|
21
|
-
Requires-Dist: pandas>=
|
|
22
|
-
Requires-Dist: psycopg2-binary>=2.9.
|
|
23
|
-
Requires-Dist: python-dotenv>=1.2.
|
|
19
|
+
Requires-Dist: custom-python-logger>=4.2.0
|
|
20
|
+
Requires-Dist: elasticsearch<9,>=8.19.3
|
|
21
|
+
Requires-Dist: pandas>=3.1.1
|
|
22
|
+
Requires-Dist: psycopg2-binary>=2.9.13
|
|
23
|
+
Requires-Dist: python-dotenv>=1.2.4
|
|
24
24
|
Requires-Dist: retrying>=1.4.2
|
|
25
25
|
Dynamic: license-file
|
|
26
26
|
|
|
@@ -138,7 +138,7 @@ def test_doc_id_is_derived_from_the_timestamp(
|
|
|
138
138
|
es.fill_elk_index_as_bulk(data=[{"n": 1}], doc_index_name="idx", chunk_size=100)
|
|
139
139
|
|
|
140
140
|
src = _sent_docs(mock_helpers)[0]["_source"]
|
|
141
|
-
ts = src["
|
|
141
|
+
ts = src["upload_timestamp"]
|
|
142
142
|
assert isinstance(ts, datetime), f"timestamp must be a datetime, got {type(ts)}"
|
|
143
143
|
assert src["doc_id"] == ts.strftime("%Y%m%dT%H%M%S%f"), "doc_id/timestamp derivation broken"
|
|
144
144
|
assert src["date_and_time_str"].startswith(src["date_str"]), "date_str is not the date half"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_databases-1.2.2 → python_databases-2.1.0}/python_databases.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|