sibi-dst 0.3.59__tar.gz → 0.3.60__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.
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/PKG-INFO +1 -1
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/pyproject.toml +1 -1
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/__init__.py +3 -1
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/storage_config.py +59 -1
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/README.md +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/_artifact_updater_multi_wrapper.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/_df_helper.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/_parquet_artifact.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/_parquet_reader.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/django/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/django/_db_connection.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/django/_io_dask.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/django/_load_from_db.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/django/_sql_model_builder.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/http/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/http/_http_config.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/parquet/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/parquet/_filter_handler.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/parquet/_parquet_options.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/sqlalchemy/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/sqlalchemy/_db_connection.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/sqlalchemy/_filter_handler.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/sqlalchemy/_io_dask.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/sqlalchemy/_load_from_db.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/sqlalchemy/_sql_model_builder.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/core/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/core/_defaults.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/core/_filter_handler.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/core/_params_config.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/core/_query_config.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/data_cleaner.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/geopy_helper/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/geopy_helper/geo_location_service.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/geopy_helper/utils.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/osmnx_helper/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/osmnx_helper/base_osm_map.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/osmnx_helper/basemaps/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/osmnx_helper/basemaps/calendar_html.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/osmnx_helper/basemaps/router_plotter.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/osmnx_helper/utils.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/tests/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/tests/test_data_wrapper_class.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/airflow_manager.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/clickhouse_writer.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/credentials.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/data_from_http_source.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/data_utils.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/data_wrapper.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/date_utils.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/df_utils.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/file_utils.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/filepath_generator.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/log_utils.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/manifest_manager.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/parquet_saver.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/phone_formatter.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/storage_manager.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/update_planner.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/utils/webdav_client.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/_df_helper.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlalchemy/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlalchemy/_db_connection.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlalchemy/_io_dask.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlalchemy/_load_from_db.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlalchemy/_model_builder.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlmodel/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlmodel/_db_connection.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlmodel/_io_dask.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlmodel/_load_from_db.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlmodel/_model_builder.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/core/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/core/_filter_handler.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/core/_params_config.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/core/_query_config.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/utils/__init__.py +0 -0
- {sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/utils/log_utils.py +0 -0
@@ -14,7 +14,7 @@ from .airflow_manager import AirflowDAGManager
|
|
14
14
|
from .credentials import *
|
15
15
|
from .update_planner import UpdatePlanner
|
16
16
|
from .data_wrapper import DataWrapper
|
17
|
-
from .storage_config import StorageConfig
|
17
|
+
from .storage_config import StorageConfig, FsRegistry
|
18
18
|
from .data_from_http_source import DataFromHttpSource
|
19
19
|
from .webdav_client import WebDAVClient
|
20
20
|
from .manifest_manager import MissingManifestManager
|
@@ -37,7 +37,9 @@ __all__ = [
|
|
37
37
|
"ClickHouseWriter",
|
38
38
|
"AirflowDAGManager",
|
39
39
|
"StorageConfig",
|
40
|
+
"FsRegistry",
|
40
41
|
"DataFromHttpSource",
|
41
42
|
"WebDAVClient",
|
42
43
|
"MissingManifestManager",
|
43
44
|
]
|
45
|
+
|
@@ -1,3 +1,7 @@
|
|
1
|
+
from threading import RLock
|
2
|
+
from typing import Dict, Callable, Any
|
3
|
+
|
4
|
+
from sibi_dst.utils import Logger
|
1
5
|
from .storage_manager import StorageManager
|
2
6
|
from .credentials import ConfigManager
|
3
7
|
|
@@ -46,4 +50,58 @@ class StorageConfig:
|
|
46
50
|
# defaulting to local filesystem
|
47
51
|
self.filesystem_type = 'file'
|
48
52
|
self.filesystem_options = {}
|
49
|
-
self.filesystem_options = {k: v for k, v in self.filesystem_options.items() if v}
|
53
|
+
self.filesystem_options = {k: v for k, v in self.filesystem_options.items() if v}
|
54
|
+
|
55
|
+
class FsRegistry:
|
56
|
+
def __init__(self, debug: bool = False, logger: Logger = None):
|
57
|
+
self._storage_registry: Dict[str, Callable[[], Any]]={}
|
58
|
+
self._fs_instance_cache: Dict[str, object] = {}
|
59
|
+
self._lock = RLock()
|
60
|
+
self.debug = debug
|
61
|
+
|
62
|
+
if logger:
|
63
|
+
self.logger = logger
|
64
|
+
else:
|
65
|
+
self.logger = Logger.default_logger(logger_name="FsRegistry")
|
66
|
+
self.logger.set_level(Logger.DEBUG if self.debug else Logger.INFO)
|
67
|
+
|
68
|
+
def register(self, name:str, manager: Any):
|
69
|
+
"""
|
70
|
+
Registers a filesystem manager instance with a name.
|
71
|
+
:param name: Name of the filesystem instance.
|
72
|
+
:param manager: Filesystem manager instance to register.
|
73
|
+
"""
|
74
|
+
if not hasattr(manager, 'get_fs_instance'):
|
75
|
+
raise TypeError("Manager must have a 'get_fs_instance' method.")
|
76
|
+
self._storage_registry[name] = lambda: manager
|
77
|
+
|
78
|
+
|
79
|
+
def get_fs_instance(self, name: str='source') -> object:
|
80
|
+
"""
|
81
|
+
Retrieve a filesystem instance from a registered storage manager.
|
82
|
+
Caches instances per name.
|
83
|
+
"""
|
84
|
+
if name in self._fs_instance_cache:
|
85
|
+
return self._fs_instance_cache[name]
|
86
|
+
|
87
|
+
if name not in self._storage_registry:
|
88
|
+
raise ValueError(f"Storage '{name}' has not been registered.")
|
89
|
+
|
90
|
+
manager = self._storage_registry[name]()
|
91
|
+
fs = manager.get_fs_instance()
|
92
|
+
self._fs_instance_cache[name] = fs
|
93
|
+
return fs
|
94
|
+
|
95
|
+
def unregister_fs(self, name: str):
|
96
|
+
"""
|
97
|
+
Unregister a storage and clear its cached fs instance.
|
98
|
+
"""
|
99
|
+
self._storage_registry.pop(name, None)
|
100
|
+
self._fs_instance_cache.pop(name, None)
|
101
|
+
|
102
|
+
|
103
|
+
def clear_fs_cache(self):
|
104
|
+
"""
|
105
|
+
Clear all cached fs instances.
|
106
|
+
"""
|
107
|
+
self._fs_instance_cache.clear()
|
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
|
File without changes
|
{sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/django/_sql_model_builder.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/sqlalchemy/_db_connection.py
RENAMED
File without changes
|
{sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/sqlalchemy/_filter_handler.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/df_helper/backends/sqlalchemy/_sql_model_builder.py
RENAMED
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
|
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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlalchemy/_db_connection.py
RENAMED
File without changes
|
File without changes
|
{sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlalchemy/_load_from_db.py
RENAMED
File without changes
|
{sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlalchemy/_model_builder.py
RENAMED
File without changes
|
File without changes
|
{sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlmodel/_db_connection.py
RENAMED
File without changes
|
File without changes
|
{sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlmodel/_load_from_db.py
RENAMED
File without changes
|
{sibi_dst-0.3.59 → sibi_dst-0.3.60}/sibi_dst/v2/df_helper/backends/sqlmodel/_model_builder.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|