python-databases 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl
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/__init__.py +0 -12
- python_databases/{elastic_search_infrastructure → elasticsearch_infrastructure}/__init__.py +1 -1
- python_databases/{elastic_search_infrastructure/elastic_search.py → elasticsearch_infrastructure/elasticsearch.py} +8 -7
- {python_databases-0.1.0.dist-info → python_databases-0.1.1.dist-info}/METADATA +1 -1
- python_databases-0.1.1.dist-info/RECORD +8 -0
- python_databases-0.1.0.dist-info/RECORD +0 -8
- {python_databases-0.1.0.dist-info → python_databases-0.1.1.dist-info}/WHEEL +0 -0
- {python_databases-0.1.0.dist-info → python_databases-0.1.1.dist-info}/licenses/LICENSE +0 -0
- {python_databases-0.1.0.dist-info → python_databases-0.1.1.dist-info}/top_level.txt +0 -0
python_databases/__init__.py
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
from dotenv import load_dotenv
|
|
2
|
-
|
|
3
|
-
from python_databases.elastic_search_infrastructure.elastic_search import (
|
|
4
|
-
UrlProtocol,
|
|
5
|
-
ElasticSearch,
|
|
6
|
-
ElasticSearchOnPrem,
|
|
7
|
-
ElasticSearchCloud
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
load_dotenv()
|
|
11
|
-
|
|
12
|
-
__all__ = ['UrlProtocol', 'ElasticSearch', 'ElasticSearchOnPrem', 'ElasticSearchCloud']
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import datetime
|
|
2
1
|
import logging
|
|
3
2
|
import time
|
|
4
3
|
from abc import ABC, abstractmethod
|
|
5
4
|
from copy import deepcopy
|
|
5
|
+
from datetime import datetime, timezone
|
|
6
6
|
from enum import Enum
|
|
7
7
|
from typing import Optional, Any
|
|
8
8
|
import pandas as pd
|
|
@@ -181,20 +181,21 @@ class ElasticSearch(ABC):
|
|
|
181
181
|
def fill_elk_index_as_bulk(
|
|
182
182
|
self,
|
|
183
183
|
data: list[dict],
|
|
184
|
-
doc_id: str,
|
|
185
184
|
doc_index_name: str,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
doc_id: Optional[str] = None,
|
|
186
|
+
timestamp: datetime = None,
|
|
187
|
+
date_and_time: Optional[str] = None,
|
|
188
|
+
username: Optional[str] = None,
|
|
189
189
|
chunk_size=1000,
|
|
190
190
|
time_sleep: int = 1
|
|
191
191
|
) -> None: # use as the main function to send data to the elastic search
|
|
192
|
+
timestamp = timestamp or datetime.now(tz=timezone.utc)
|
|
192
193
|
list_of_docs = self._prepare_documents_for_bulk(
|
|
193
194
|
data=data,
|
|
194
|
-
doc_id=doc_id,
|
|
195
195
|
doc_index_name=doc_index_name,
|
|
196
196
|
timestamp=timestamp,
|
|
197
|
-
|
|
197
|
+
doc_id=doc_id or timestamp.strftime('%Y_%m_%dT%H_%M_%S_%f'),
|
|
198
|
+
date_and_time=date_and_time or timestamp.isoformat(),
|
|
198
199
|
username=username
|
|
199
200
|
)
|
|
200
201
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
python_databases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
python_databases/elasticsearch_infrastructure/__init__.py,sha256=zLL3GJwgu5a55TgRhyl_mDbjc-qQBWOskRc0y9diqyw,296
|
|
3
|
+
python_databases/elasticsearch_infrastructure/elasticsearch.py,sha256=U8PVhjImk_S35KJHKEFK7Fl8cL-0A36yzLJ_KgtNTIY,11160
|
|
4
|
+
python_databases-0.1.1.dist-info/licenses/LICENSE,sha256=cSikHY6SZFsPZSBizCDAJ0-Bjjzxt-JtX6TVbKxwimo,1067
|
|
5
|
+
python_databases-0.1.1.dist-info/METADATA,sha256=V1Ilj_5WPwjO_tWwKWGWVZPYSRWIsZzysMMh7rbLwBY,846
|
|
6
|
+
python_databases-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
python_databases-0.1.1.dist-info/top_level.txt,sha256=fXcMUntaYJfKeFS7FjQ6DY4WVXYBsgdrDmhOudYs-vg,17
|
|
8
|
+
python_databases-0.1.1.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
python_databases/__init__.py,sha256=NjWdKySjMPaJk8eCFiw54p1ddv42zGj3aVFTVvfkT3E,298
|
|
2
|
-
python_databases/elastic_search_infrastructure/__init__.py,sha256=NjWdKySjMPaJk8eCFiw54p1ddv42zGj3aVFTVvfkT3E,298
|
|
3
|
-
python_databases/elastic_search_infrastructure/elastic_search.py,sha256=1W1jRByLljUDHLE8MqdIOHI_ak6CRKq7YLf09wKwTqQ,10951
|
|
4
|
-
python_databases-0.1.0.dist-info/licenses/LICENSE,sha256=cSikHY6SZFsPZSBizCDAJ0-Bjjzxt-JtX6TVbKxwimo,1067
|
|
5
|
-
python_databases-0.1.0.dist-info/METADATA,sha256=eiuP5xi7JuN_9qYiTWU_0f0huTQ9gfTXj9bX-ZqKwHU,846
|
|
6
|
-
python_databases-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
python_databases-0.1.0.dist-info/top_level.txt,sha256=fXcMUntaYJfKeFS7FjQ6DY4WVXYBsgdrDmhOudYs-vg,17
|
|
8
|
-
python_databases-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|