thoth-dbmanager 0.4.12__py3-none-any.whl → 0.5.0__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.
- thoth_dbmanager/ThothDbManager.py +19 -227
- thoth_dbmanager/__init__.py +8 -63
- thoth_dbmanager/core/registry.py +14 -0
- thoth_dbmanager/helpers/multi_db_generator.py +1 -1
- thoth_dbmanager/plugins/sqlite.py +7 -0
- {thoth_dbmanager-0.4.12.dist-info → thoth_dbmanager-0.5.0.dist-info}/METADATA +3 -3
- {thoth_dbmanager-0.4.12.dist-info → thoth_dbmanager-0.5.0.dist-info}/RECORD +10 -10
- {thoth_dbmanager-0.4.12.dist-info → thoth_dbmanager-0.5.0.dist-info}/WHEEL +0 -0
- {thoth_dbmanager-0.4.12.dist-info → thoth_dbmanager-0.5.0.dist-info}/licenses/LICENSE +0 -0
- {thoth_dbmanager-0.4.12.dist-info → thoth_dbmanager-0.5.0.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,3 @@
|
|
1
|
-
import pickle
|
2
1
|
import logging
|
3
2
|
from abc import ABC, abstractmethod
|
4
3
|
from pathlib import Path
|
@@ -7,20 +6,15 @@ from typing import Any, Dict, List, Optional, Union, ClassVar, Type, TypeVar
|
|
7
6
|
|
8
7
|
from .lsh.manager import LshManager
|
9
8
|
from .core.factory import ThothDbFactory
|
10
|
-
from .core.interfaces import DbPlugin
|
11
|
-
|
12
|
-
# Import plugins to register them
|
13
|
-
from .plugins.postgresql import PostgreSQLPlugin
|
14
|
-
from .plugins.sqlite import SQLitePlugin
|
15
9
|
|
16
10
|
T = TypeVar('T', bound='ThothDbManager')
|
17
11
|
|
18
12
|
class ThothDbManager(ABC):
|
19
13
|
"""
|
20
|
-
|
21
|
-
It follows a singleton pattern for each unique set of connection parameters.
|
14
|
+
Modern database manager interface using plugin architecture.
|
22
15
|
|
23
|
-
This class
|
16
|
+
This class provides a unified interface for database operations
|
17
|
+
across multiple database types through the plugin system.
|
24
18
|
"""
|
25
19
|
_instances: ClassVar[Dict[tuple, Any]] = {}
|
26
20
|
_lock: ClassVar[Lock] = Lock()
|
@@ -28,10 +22,7 @@ class ThothDbManager(ABC):
|
|
28
22
|
@classmethod
|
29
23
|
def get_instance(cls: Type[T], db_type: str, **kwargs) -> T:
|
30
24
|
"""
|
31
|
-
Get or create a singleton instance
|
32
|
-
This acts as a factory for different database manager implementations.
|
33
|
-
|
34
|
-
Now uses the new plugin architecture while maintaining backward compatibility.
|
25
|
+
Get or create a singleton instance using the plugin architecture.
|
35
26
|
|
36
27
|
Args:
|
37
28
|
db_type (str): The type of database (e.g., 'postgresql', 'sqlite', 'mysql').
|
@@ -43,40 +34,13 @@ class ThothDbManager(ABC):
|
|
43
34
|
Raises:
|
44
35
|
ValueError: If the database type is unsupported or required parameters are missing.
|
45
36
|
"""
|
46
|
-
#
|
47
|
-
|
48
|
-
if db_type in ["postgresql", "sqlite"]: # Currently supported by new architecture
|
49
|
-
# Extract required parameters
|
50
|
-
db_root_path = kwargs.get('db_root_path')
|
51
|
-
db_mode = kwargs.get('db_mode', 'dev')
|
52
|
-
|
53
|
-
if not db_root_path:
|
54
|
-
raise ValueError("db_root_path is required")
|
55
|
-
|
56
|
-
# Remove extracted parameters from kwargs to avoid duplicate parameter errors
|
57
|
-
kwargs_clean = kwargs.copy()
|
58
|
-
kwargs_clean.pop('db_root_path', None)
|
59
|
-
kwargs_clean.pop('db_mode', None)
|
60
|
-
|
61
|
-
# Create plugin instance using factory
|
62
|
-
plugin = ThothDbFactory.create_manager(db_type, db_root_path, db_mode, **kwargs_clean)
|
63
|
-
|
64
|
-
# Wrap plugin in compatibility adapter
|
65
|
-
return ThothDbManagerAdapter(plugin)
|
66
|
-
|
67
|
-
except Exception as e:
|
68
|
-
logging.warning(f"Failed to use new plugin architecture for {db_type}: {e}. Falling back to legacy implementation.")
|
37
|
+
# Import all plugins to ensure they're registered
|
38
|
+
from . import plugins
|
69
39
|
|
70
|
-
# Use unified plugin system for all database types
|
71
40
|
try:
|
72
|
-
# Import all plugins to ensure they're registered
|
73
|
-
from . import plugins
|
74
|
-
|
75
41
|
# Create plugin instance using factory
|
76
42
|
plugin = ThothDbFactory.create_manager(db_type, **kwargs)
|
77
|
-
|
78
|
-
# Wrap plugin in compatibility adapter
|
79
|
-
return ThothDbManagerAdapter(plugin)
|
43
|
+
return plugin
|
80
44
|
|
81
45
|
except Exception as e:
|
82
46
|
logging.error(f"Failed to create {db_type} manager: {e}")
|
@@ -103,11 +67,6 @@ class ThothDbManager(ABC):
|
|
103
67
|
self.db_id = None
|
104
68
|
self.db_directory_path = None
|
105
69
|
|
106
|
-
# LSH related attributes (for backward compatibility)
|
107
|
-
self.lsh = None
|
108
|
-
self.minhashes = None
|
109
|
-
self.vector_db = None
|
110
|
-
|
111
70
|
# New LSH manager (lazy initialization)
|
112
71
|
self._lsh_manager = None
|
113
72
|
|
@@ -245,44 +204,6 @@ class ThothDbManager(ABC):
|
|
245
204
|
"""
|
246
205
|
pass
|
247
206
|
|
248
|
-
def set_lsh(self) -> str:
|
249
|
-
"""
|
250
|
-
Sets the LSH and minhashes attributes by loading from storage.
|
251
|
-
|
252
|
-
This method maintains backward compatibility while using the new LSH manager.
|
253
|
-
"""
|
254
|
-
with self._lock:
|
255
|
-
if self.lsh is None:
|
256
|
-
try:
|
257
|
-
# Use the new LSH manager
|
258
|
-
if self.lsh_manager and self.lsh_manager.load_lsh():
|
259
|
-
# Set backward compatibility attributes
|
260
|
-
self.lsh = self.lsh_manager.lsh
|
261
|
-
self.minhashes = self.lsh_manager.minhashes
|
262
|
-
return "success"
|
263
|
-
else:
|
264
|
-
# Fallback to old method for compatibility
|
265
|
-
lsh_path = self.db_directory_path / "preprocessed" / f"{self.db_id}_lsh.pkl"
|
266
|
-
minhashes_path = self.db_directory_path / "preprocessed" / f"{self.db_id}_minhashes.pkl"
|
267
|
-
|
268
|
-
if not lsh_path.exists() or not minhashes_path.exists():
|
269
|
-
raise FileNotFoundError(f"LSH or MinHashes file not found for {self.db_id}")
|
270
|
-
|
271
|
-
with lsh_path.open("rb") as file:
|
272
|
-
self.lsh = pickle.load(file)
|
273
|
-
with minhashes_path.open("rb") as file:
|
274
|
-
self.minhashes = pickle.load(file)
|
275
|
-
return "success"
|
276
|
-
except Exception as e:
|
277
|
-
logging.error(f"Error loading LSH: {str(e)}")
|
278
|
-
self.lsh = "error"
|
279
|
-
self.minhashes = "error"
|
280
|
-
return "error"
|
281
|
-
elif self.lsh == "error":
|
282
|
-
return "error"
|
283
|
-
else:
|
284
|
-
return "success"
|
285
|
-
|
286
207
|
def query_lsh(self,
|
287
208
|
keyword: str,
|
288
209
|
signature_size: int = 30,
|
@@ -303,7 +224,6 @@ class ThothDbManager(ABC):
|
|
303
224
|
- inner key is column name
|
304
225
|
- value is list of similar strings
|
305
226
|
"""
|
306
|
-
# Try using the new LSH manager first
|
307
227
|
if self.lsh_manager:
|
308
228
|
try:
|
309
229
|
return self.lsh_manager.query(
|
@@ -313,148 +233,20 @@ class ThothDbManager(ABC):
|
|
313
233
|
top_n=top_n
|
314
234
|
)
|
315
235
|
except Exception as e:
|
316
|
-
logging.
|
317
|
-
|
318
|
-
# Fallback to old method for backward compatibility
|
319
|
-
lsh_status = self.set_lsh()
|
320
|
-
if lsh_status == "success":
|
321
|
-
# Import here to avoid circular imports
|
322
|
-
from .helpers.search import _query_lsh
|
323
|
-
return _query_lsh(self.lsh, self.minhashes, keyword, signature_size, n_gram, top_n)
|
236
|
+
logging.error(f"LSH manager query failed: {e}")
|
237
|
+
raise Exception(f"Error querying LSH for {self.db_id}: {e}")
|
324
238
|
else:
|
325
|
-
raise Exception(f"
|
326
|
-
|
239
|
+
raise Exception(f"LSH manager not initialized for {self.db_id}")
|
327
240
|
|
328
|
-
|
329
|
-
"""
|
330
|
-
Adapter class that wraps the new plugin architecture to provide backward compatibility
|
331
|
-
with the original ThothDbManager interface.
|
332
|
-
"""
|
333
|
-
|
334
|
-
def __init__(self, plugin: DbPlugin):
|
241
|
+
def health_check(self) -> bool:
|
335
242
|
"""
|
336
|
-
|
243
|
+
Check if database connection is healthy.
|
337
244
|
|
338
|
-
|
339
|
-
|
245
|
+
Returns:
|
246
|
+
bool: True if connection is healthy, False otherwise
|
340
247
|
"""
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
self.db_type = plugin.supported_db_types[0] if plugin.supported_db_types else "unknown"
|
347
|
-
self.db_id = getattr(plugin, 'db_id', None)
|
348
|
-
self.db_directory_path = getattr(plugin, 'db_directory_path', None)
|
349
|
-
self.schema = getattr(plugin, 'schema', "")
|
350
|
-
|
351
|
-
# Engine and connection (delegated to adapter)
|
352
|
-
self.engine = getattr(plugin.adapter, 'engine', None) if plugin.adapter else None
|
353
|
-
|
354
|
-
# LSH related attributes (for backward compatibility)
|
355
|
-
self.lsh = None
|
356
|
-
self.minhashes = None
|
357
|
-
self.vector_db = None
|
358
|
-
|
359
|
-
# Flag to track initialization
|
360
|
-
self._initialized = plugin._initialized
|
361
|
-
|
362
|
-
@property
|
363
|
-
def lsh_manager(self):
|
364
|
-
"""Access LSH manager through plugin"""
|
365
|
-
return getattr(self.plugin, 'lsh_manager', None)
|
366
|
-
|
367
|
-
def execute_sql(self, sql: str, params: Optional[Dict] = None, fetch: Union[str, int] = "all", timeout: int = 60) -> Any:
|
368
|
-
"""Execute SQL queries through plugin"""
|
369
|
-
return self.plugin.execute_sql(sql, params, fetch, timeout)
|
370
|
-
|
371
|
-
def get_unique_values(self) -> Dict[str, Dict[str, List[str]]]:
|
372
|
-
"""Get unique values through plugin"""
|
373
|
-
return self.plugin.get_unique_values()
|
374
|
-
|
375
|
-
def get_tables(self) -> List[Dict[str, str]]:
|
376
|
-
"""Get tables through plugin"""
|
377
|
-
return self.plugin.get_tables()
|
378
|
-
|
379
|
-
def get_columns(self, table_name: str) -> List[Dict[str, Any]]:
|
380
|
-
"""Get columns through plugin"""
|
381
|
-
return self.plugin.get_columns(table_name)
|
382
|
-
|
383
|
-
def get_foreign_keys(self) -> List[Dict[str, str]]:
|
384
|
-
"""Get foreign keys through plugin"""
|
385
|
-
return self.plugin.get_foreign_keys()
|
386
|
-
|
387
|
-
def set_lsh(self) -> str:
|
388
|
-
"""Set LSH through plugin"""
|
389
|
-
if hasattr(self.plugin, 'set_lsh'):
|
390
|
-
result = self.plugin.set_lsh()
|
391
|
-
|
392
|
-
# Update backward compatibility attributes
|
393
|
-
if result == "success" and self.lsh_manager:
|
394
|
-
self.lsh = getattr(self.lsh_manager, 'lsh', None)
|
395
|
-
self.minhashes = getattr(self.lsh_manager, 'minhashes', None)
|
396
|
-
|
397
|
-
return result
|
398
|
-
else:
|
399
|
-
# Fallback to original implementation
|
400
|
-
return super().set_lsh()
|
401
|
-
|
402
|
-
def query_lsh(self, keyword: str, signature_size: int = 30, n_gram: int = 3, top_n: int = 10) -> Dict[str, Dict[str, List[str]]]:
|
403
|
-
"""Query LSH through plugin"""
|
404
|
-
if hasattr(self.plugin, 'query_lsh'):
|
405
|
-
return self.plugin.query_lsh(keyword, signature_size, n_gram, top_n)
|
406
|
-
else:
|
407
|
-
# Fallback to original implementation
|
408
|
-
return super().query_lsh(keyword, signature_size, n_gram, top_n)
|
409
|
-
|
410
|
-
# Document-based methods (new functionality)
|
411
|
-
def get_tables_as_documents(self):
|
412
|
-
"""Get tables as document objects"""
|
413
|
-
if self.plugin.adapter:
|
414
|
-
return self.plugin.adapter.get_tables_as_documents()
|
415
|
-
return []
|
416
|
-
|
417
|
-
def get_columns_as_documents(self, table_name: str):
|
418
|
-
"""Get columns as document objects"""
|
419
|
-
if self.plugin.adapter:
|
420
|
-
return self.plugin.adapter.get_columns_as_documents(table_name)
|
421
|
-
return []
|
422
|
-
|
423
|
-
def get_foreign_keys_as_documents(self):
|
424
|
-
"""Get foreign keys as document objects"""
|
425
|
-
if self.plugin.adapter:
|
426
|
-
return self.plugin.adapter.get_foreign_keys_as_documents()
|
427
|
-
return []
|
428
|
-
|
429
|
-
def get_schemas_as_documents(self):
|
430
|
-
"""Get schemas as document objects"""
|
431
|
-
if self.plugin.adapter:
|
432
|
-
return self.plugin.adapter.get_schemas_as_documents()
|
433
|
-
return []
|
434
|
-
|
435
|
-
def get_indexes_as_documents(self, table_name: Optional[str] = None):
|
436
|
-
"""Get indexes as document objects"""
|
437
|
-
if self.plugin.adapter:
|
438
|
-
return self.plugin.adapter.get_indexes_as_documents(table_name)
|
439
|
-
return []
|
440
|
-
|
441
|
-
def get_connection_info(self) -> Dict[str, Any]:
|
442
|
-
"""Get connection information"""
|
443
|
-
if hasattr(self.plugin, 'get_connection_info'):
|
444
|
-
return self.plugin.get_connection_info()
|
445
|
-
return {}
|
446
|
-
|
447
|
-
def health_check(self) -> bool:
|
448
|
-
"""Check database health"""
|
449
|
-
if self.plugin.adapter:
|
450
|
-
return self.plugin.adapter.health_check()
|
451
|
-
return False
|
452
|
-
|
453
|
-
def get_example_data(self, table_name: str, number_of_rows: int = 30) -> Dict[str, List[Any]]:
|
454
|
-
"""Get example data through plugin"""
|
455
|
-
if hasattr(self.plugin, 'get_example_data'):
|
456
|
-
return self.plugin.get_example_data(table_name, number_of_rows)
|
457
|
-
elif self.plugin.adapter:
|
458
|
-
return self.plugin.adapter.get_example_data(table_name, number_of_rows)
|
459
|
-
else:
|
460
|
-
raise RuntimeError("Plugin not initialized or doesn't support get_example_data")
|
248
|
+
try:
|
249
|
+
self.execute_sql("SELECT 1", fetch="one")
|
250
|
+
return True
|
251
|
+
except Exception:
|
252
|
+
return False
|
thoth_dbmanager/__init__.py
CHANGED
@@ -5,7 +5,7 @@ This package provides database-agnostic operations, LSH similarity search,
|
|
5
5
|
and an extensible plugin architecture for managing SQL databases.
|
6
6
|
"""
|
7
7
|
|
8
|
-
# Core classes
|
8
|
+
# Core classes
|
9
9
|
from .ThothDbManager import ThothDbManager
|
10
10
|
from .core.factory import ThothDbFactory
|
11
11
|
from .core.interfaces import DbPlugin, DbAdapter
|
@@ -24,7 +24,7 @@ from .documents import (
|
|
24
24
|
create_document
|
25
25
|
)
|
26
26
|
|
27
|
-
#
|
27
|
+
# LSH functionality
|
28
28
|
from .lsh.factory import make_db_lsh
|
29
29
|
from .lsh import LshManager, LshFactory
|
30
30
|
|
@@ -36,50 +36,13 @@ from .dynamic_imports import (
|
|
36
36
|
get_available_databases,
|
37
37
|
import_database_components,
|
38
38
|
DatabaseImportError,
|
39
|
-
# Convenience functions
|
40
|
-
import_postgresql,
|
41
|
-
import_mysql,
|
42
|
-
import_sqlite,
|
43
|
-
import_sqlserver,
|
44
|
-
import_oracle,
|
45
|
-
import_mariadb,
|
46
|
-
import_supabase,
|
47
39
|
)
|
48
40
|
|
49
|
-
#
|
50
|
-
def __getattr__(name: str):
|
51
|
-
"""Dynamic attribute access for database managers."""
|
52
|
-
if name == 'ThothPgManager':
|
53
|
-
return import_manager('postgresql')
|
54
|
-
elif name == 'ThothSqliteManager':
|
55
|
-
return import_manager('sqlite')
|
56
|
-
elif name == 'ThothMySqlManager':
|
57
|
-
return import_manager('mysql')
|
58
|
-
elif name == 'ThothMariaDbManager':
|
59
|
-
return import_manager('mariadb')
|
60
|
-
elif name == 'ThothSqlServerManager':
|
61
|
-
return import_manager('sqlserver')
|
62
|
-
elif name == 'ThothOracleManager':
|
63
|
-
return import_manager('oracle')
|
64
|
-
elif name == 'ThothSupabaseManager':
|
65
|
-
return import_manager('supabase')
|
66
|
-
|
67
|
-
raise AttributeError(f"module 'thoth_dbmanager' has no attribute '{name}'")
|
68
|
-
|
69
|
-
# Public API
|
41
|
+
# Public API - Modern Plugin Architecture Only
|
70
42
|
__all__ = [
|
71
|
-
#
|
43
|
+
# Core API
|
72
44
|
"ThothDbManager",
|
73
|
-
"
|
74
|
-
"ThothSqliteManager",
|
75
|
-
"ThothMySqlManager",
|
76
|
-
"ThothMariaDbManager",
|
77
|
-
"ThothSqlServerManager",
|
78
|
-
"ThothOracleManager",
|
79
|
-
"ThothSupabaseManager",
|
80
|
-
|
81
|
-
# New architecture
|
82
|
-
"ThothDbFactory",
|
45
|
+
"ThothDbFactory",
|
83
46
|
"DbPluginRegistry",
|
84
47
|
"DbPlugin",
|
85
48
|
"DbAdapter",
|
@@ -87,7 +50,7 @@ __all__ = [
|
|
87
50
|
# Document models
|
88
51
|
"BaseThothDbDocument",
|
89
52
|
"TableDocument",
|
90
|
-
"ColumnDocument",
|
53
|
+
"ColumnDocument",
|
91
54
|
"QueryDocument",
|
92
55
|
"SchemaDocument",
|
93
56
|
"ForeignKeyDocument",
|
@@ -95,24 +58,6 @@ __all__ = [
|
|
95
58
|
"ThothDbType",
|
96
59
|
"create_document",
|
97
60
|
|
98
|
-
# Plugins
|
99
|
-
"PostgreSQLPlugin",
|
100
|
-
"SQLitePlugin",
|
101
|
-
"MySQLPlugin",
|
102
|
-
"MariaDBPlugin",
|
103
|
-
"SQLServerPlugin",
|
104
|
-
"OraclePlugin",
|
105
|
-
"SupabasePlugin",
|
106
|
-
|
107
|
-
# Adapters
|
108
|
-
"PostgreSQLAdapter",
|
109
|
-
"SQLiteAdapter",
|
110
|
-
"MySQLAdapter",
|
111
|
-
"MariaDBAdapter",
|
112
|
-
"SQLServerAdapter",
|
113
|
-
"OracleAdapter",
|
114
|
-
"SupabaseAdapter",
|
115
|
-
|
116
61
|
# LSH functionality
|
117
62
|
"make_db_lsh",
|
118
63
|
"LshManager",
|
@@ -120,11 +65,11 @@ __all__ = [
|
|
120
65
|
|
121
66
|
# Dynamic import system
|
122
67
|
"import_manager",
|
123
|
-
"import_adapter",
|
68
|
+
"import_adapter",
|
124
69
|
"import_plugin",
|
125
70
|
"get_available_databases",
|
126
71
|
"import_database_components",
|
127
72
|
"DatabaseImportError",
|
128
73
|
]
|
129
74
|
|
130
|
-
__version__ = "0.
|
75
|
+
__version__ = "0.5.0"
|
thoth_dbmanager/core/registry.py
CHANGED
@@ -16,6 +16,7 @@ class DbPluginRegistry:
|
|
16
16
|
|
17
17
|
_plugins: Dict[str, Type[DbPlugin]] = {}
|
18
18
|
_instances: Dict[tuple, DbPlugin] = {} # Singleton instances
|
19
|
+
_registered_plugins: set = set() # Track already registered plugins to avoid spam
|
19
20
|
|
20
21
|
@classmethod
|
21
22
|
def register(cls, db_type: str, plugin_class: Type[DbPlugin]) -> None:
|
@@ -29,7 +30,15 @@ class DbPluginRegistry:
|
|
29
30
|
if not issubclass(plugin_class, DbPlugin):
|
30
31
|
raise TypeError(f"Plugin class {plugin_class.__name__} must inherit from DbPlugin")
|
31
32
|
|
33
|
+
# Check if plugin is already registered to avoid spam logs
|
34
|
+
plugin_key = f"{db_type}:{plugin_class.__name__}"
|
35
|
+
if plugin_key in cls._registered_plugins:
|
36
|
+
# Plugin already registered, don't log again
|
37
|
+
cls._plugins[db_type] = plugin_class
|
38
|
+
return
|
39
|
+
|
32
40
|
cls._plugins[db_type] = plugin_class
|
41
|
+
cls._registered_plugins.add(plugin_key)
|
33
42
|
logger.info(f"Registered plugin {plugin_class.__name__} for database type '{db_type}'")
|
34
43
|
|
35
44
|
@classmethod
|
@@ -44,6 +53,10 @@ class DbPluginRegistry:
|
|
44
53
|
plugin_class = cls._plugins.pop(db_type)
|
45
54
|
logger.info(f"Unregistered plugin {plugin_class.__name__} for database type '{db_type}'")
|
46
55
|
|
56
|
+
# Remove from registered plugins set
|
57
|
+
plugin_key = f"{db_type}:{plugin_class.__name__}"
|
58
|
+
cls._registered_plugins.discard(plugin_key)
|
59
|
+
|
47
60
|
# Remove any cached instances
|
48
61
|
keys_to_remove = [key for key in cls._instances.keys() if key[0] == db_type]
|
49
62
|
for key in keys_to_remove:
|
@@ -198,6 +211,7 @@ class DbPluginRegistry:
|
|
198
211
|
"""Clear the entire plugin registry."""
|
199
212
|
cls._plugins.clear()
|
200
213
|
cls._instances.clear()
|
214
|
+
cls._registered_plugins.clear()
|
201
215
|
logger.info("Cleared plugin registry")
|
202
216
|
|
203
217
|
|
@@ -218,3 +218,10 @@ class SQLitePlugin(DbPlugin):
|
|
218
218
|
return self.adapter.get_example_data(table_name, number_of_rows)
|
219
219
|
else:
|
220
220
|
raise RuntimeError("Plugin not initialized")
|
221
|
+
|
222
|
+
def health_check(self) -> bool:
|
223
|
+
"""Check database connection health"""
|
224
|
+
if self.adapter:
|
225
|
+
return self.adapter.health_check()
|
226
|
+
else:
|
227
|
+
return False
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: thoth_dbmanager
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.5.0
|
4
4
|
Summary: A Python library for managing SQL databases with support for multiple database types, LSH-based similarity search, and a modern plugin architecture.
|
5
5
|
Author-email: Marco Pancotti <mp@tylconsulting.it>
|
6
6
|
Project-URL: Homepage, https://github.com/mptyl/thoth_dbmanager
|
@@ -44,7 +44,7 @@ Requires-Dist: oracledb>=3.0.0; extra == "oracle"
|
|
44
44
|
Provides-Extra: supabase
|
45
45
|
Requires-Dist: supabase>=2.0.0; extra == "supabase"
|
46
46
|
Requires-Dist: postgrest-py>=0.10.0; extra == "supabase"
|
47
|
-
Requires-Dist: gotrue
|
47
|
+
Requires-Dist: gotrue>=1.0.0; extra == "supabase"
|
48
48
|
Provides-Extra: sqlite
|
49
49
|
Provides-Extra: all
|
50
50
|
Requires-Dist: psycopg2-binary>=2.9.0; extra == "all"
|
@@ -84,7 +84,7 @@ A Python library for managing SQL databases with support for multiple database t
|
|
84
84
|
- **Plugin Architecture**: Extensible design for adding new database types
|
85
85
|
- **LSH Search**: Locality-Sensitive Hashing for finding similar values across database columns
|
86
86
|
- **Type Safety**: Pydantic-based document models for structured data
|
87
|
-
- **
|
87
|
+
- **Modern API**: Clean, plugin-based interface for all database operations
|
88
88
|
|
89
89
|
## Installation
|
90
90
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
thoth_dbmanager/ThothDbManager.py,sha256=
|
2
|
-
thoth_dbmanager/__init__.py,sha256=
|
1
|
+
thoth_dbmanager/ThothDbManager.py,sha256=q-jctgt3MJCDFzq6icQdP1oLeVy1ypg402F4ybxhG8c,8943
|
2
|
+
thoth_dbmanager/__init__.py,sha256=Qrd9n7YYMkNKCFiIkzWbjKf5LNOkfp4TkebEpsKqt7E,1655
|
3
3
|
thoth_dbmanager/documents.py,sha256=z-f7zo_CZHqoGM0qHT8-lSUx4NhnMNZTSajpoFtRxn4,5051
|
4
4
|
thoth_dbmanager/dynamic_imports.py,sha256=nqMmxl2KeczAK-Bi5Fq92f3rPpPsTay-Bq553iHFbWI,7507
|
5
5
|
thoth_dbmanager/adapters/__init__.py,sha256=tKIMlo9-gbH_cqnqZJ9yw1zQZKUzsV4hljDUNzcoZXg,486
|
@@ -13,9 +13,9 @@ thoth_dbmanager/adapters/supabase.py,sha256=bl2C6LpOpykPF3vIbdNRDk43aXLADzSk0wQu
|
|
13
13
|
thoth_dbmanager/core/__init__.py,sha256=FlqNW0GZNv1rnwNgyXGzveLqaw0Z90y5AKhR_1DvHBE,269
|
14
14
|
thoth_dbmanager/core/factory.py,sha256=sLj8tKI1ADqSlnU5F0NRtHHtpSimnATuwAqUYx5dfxI,9694
|
15
15
|
thoth_dbmanager/core/interfaces.py,sha256=wZpKVQJdwMlAsHTQMB7yVviD2-N_dlOe19F-GhgEoGE,9576
|
16
|
-
thoth_dbmanager/core/registry.py,sha256=
|
16
|
+
thoth_dbmanager/core/registry.py,sha256=url4qpQMoMw4rDrdAAvV6L7-NdO4z86xSJPSwTH_l5g,8624
|
17
17
|
thoth_dbmanager/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
|
-
thoth_dbmanager/helpers/multi_db_generator.py,sha256=
|
18
|
+
thoth_dbmanager/helpers/multi_db_generator.py,sha256=frN0SZtWAfeojoJFLs4XLR3ri6h9pHYc-2O4aLAOlbo,23238
|
19
19
|
thoth_dbmanager/helpers/preprocess_values.py,sha256=sKMjD50UL2CZG7-g7KGe3TJQeXmXC7n28LGge8CaP5c,6183
|
20
20
|
thoth_dbmanager/helpers/schema.py,sha256=PhHgUxfFe7qUPxdpWQ3YfS593VQjyKtaSKMlChCyLNo,13978
|
21
21
|
thoth_dbmanager/helpers/search.py,sha256=k04L7clSPfeQOlq_ifsH3PZ21ZK-rujh_Qy4hWrvSso,3970
|
@@ -29,11 +29,11 @@ thoth_dbmanager/plugins/mariadb.py,sha256=ElYa4Rexwrofcjcs0UQKan8fZpbU6-n9zghYR9
|
|
29
29
|
thoth_dbmanager/plugins/mysql.py,sha256=mbDsIDV2H_BWYANU4JHMsUkxLQICuGtjKTTPbig2Ngs,16546
|
30
30
|
thoth_dbmanager/plugins/oracle.py,sha256=k4Yxvz5MdsH3Sfty9lxbhr8igSnHvGbGujz3bLpNcHo,5230
|
31
31
|
thoth_dbmanager/plugins/postgresql.py,sha256=pI1W9oHpQty8tHMoEDcsOT-Msv6S4aoFcArOGFxLR7Q,5518
|
32
|
-
thoth_dbmanager/plugins/sqlite.py,sha256=
|
32
|
+
thoth_dbmanager/plugins/sqlite.py,sha256=B-9ATDQacaBHbQTexWNeJo1_F2k1z6JrsApiYI_3FgM,8853
|
33
33
|
thoth_dbmanager/plugins/sqlserver.py,sha256=mMb3F5FmSWV02FZwj-Ult-2TjuyeVA4Fl1iME1dbgLU,5289
|
34
34
|
thoth_dbmanager/plugins/supabase.py,sha256=mWlaGAdpywx4-pU4Ffpmn24ze8sg0sM5kc6bFDoeYRg,8645
|
35
|
-
thoth_dbmanager-0.
|
36
|
-
thoth_dbmanager-0.
|
37
|
-
thoth_dbmanager-0.
|
38
|
-
thoth_dbmanager-0.
|
39
|
-
thoth_dbmanager-0.
|
35
|
+
thoth_dbmanager-0.5.0.dist-info/licenses/LICENSE,sha256=81-BOzGgwtY1XdYfkwMQB87AkOGXI9OMq0kjNcZA4UE,1071
|
36
|
+
thoth_dbmanager-0.5.0.dist-info/METADATA,sha256=WbpRrYaYFg0H_EOUPPsjMfsTmuhuMvPSGI50jQthJLM,12246
|
37
|
+
thoth_dbmanager-0.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
38
|
+
thoth_dbmanager-0.5.0.dist-info/top_level.txt,sha256=b9ttxm9RUc0KUCASEKRx6FqoREYJ1-KZWSpNuaM0uQ4,16
|
39
|
+
thoth_dbmanager-0.5.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|