python-databases 0.1.0__tar.gz → 0.1.1__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.
Files changed (17) hide show
  1. {python_databases-0.1.0/python_databases.egg-info → python_databases-0.1.1}/PKG-INFO +1 -1
  2. python_databases-0.1.1/python_databases/__init__.py +0 -0
  3. {python_databases-0.1.0/python_databases → python_databases-0.1.1/python_databases/elasticsearch_infrastructure}/__init__.py +1 -1
  4. python_databases-0.1.0/python_databases/elastic_search_infrastructure/elastic_search.py → python_databases-0.1.1/python_databases/elasticsearch_infrastructure/elasticsearch.py +8 -7
  5. {python_databases-0.1.0 → python_databases-0.1.1/python_databases.egg-info}/PKG-INFO +1 -1
  6. {python_databases-0.1.0 → python_databases-0.1.1}/python_databases.egg-info/SOURCES.txt +2 -2
  7. {python_databases-0.1.0 → python_databases-0.1.1}/setup.py +1 -1
  8. python_databases-0.1.0/python_databases/elastic_search_infrastructure/__init__.py +0 -12
  9. {python_databases-0.1.0 → python_databases-0.1.1}/LICENSE +0 -0
  10. {python_databases-0.1.0 → python_databases-0.1.1}/MANIFEST.in +0 -0
  11. {python_databases-0.1.0 → python_databases-0.1.1}/README.md +0 -0
  12. {python_databases-0.1.0 → python_databases-0.1.1}/pyproject.toml +0 -0
  13. {python_databases-0.1.0 → python_databases-0.1.1}/python_databases.egg-info/dependency_links.txt +0 -0
  14. {python_databases-0.1.0 → python_databases-0.1.1}/python_databases.egg-info/requires.txt +0 -0
  15. {python_databases-0.1.0 → python_databases-0.1.1}/python_databases.egg-info/top_level.txt +0 -0
  16. {python_databases-0.1.0 → python_databases-0.1.1}/requirements.txt +0 -0
  17. {python_databases-0.1.0 → python_databases-0.1.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-databases
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: A Python library for managing and interacting with multiple databases seamlessly.
5
5
  Home-page: https://github.com/aviz92/python-databases
6
6
  Author: Avi Zaguri
File without changes
@@ -1,6 +1,6 @@
1
1
  from dotenv import load_dotenv
2
2
 
3
- from python_databases.elastic_search_infrastructure.elastic_search import (
3
+ from python_databases.elasticsearch_infrastructure.elasticsearch import (
4
4
  UrlProtocol,
5
5
  ElasticSearch,
6
6
  ElasticSearchOnPrem,
@@ -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
- timestamp: datetime,
187
- date_and_time: str,
188
- username: str = None,
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
- date_and_time=date_and_time,
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-databases
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: A Python library for managing and interacting with multiple databases seamlessly.
5
5
  Home-page: https://github.com/aviz92/python-databases
6
6
  Author: Avi Zaguri
@@ -10,5 +10,5 @@ python_databases.egg-info/SOURCES.txt
10
10
  python_databases.egg-info/dependency_links.txt
11
11
  python_databases.egg-info/requires.txt
12
12
  python_databases.egg-info/top_level.txt
13
- python_databases/elastic_search_infrastructure/__init__.py
14
- python_databases/elastic_search_infrastructure/elastic_search.py
13
+ python_databases/elasticsearch_infrastructure/__init__.py
14
+ python_databases/elasticsearch_infrastructure/elasticsearch.py
@@ -1,6 +1,6 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
- package_version = '0.1.0'
3
+ package_version = '0.1.1'
4
4
 
5
5
  package_name = 'python-databases'
6
6
  package_description = 'A Python library for managing and interacting with multiple databases seamlessly.'
@@ -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']