thoth-dbmanager 0.4.9__tar.gz → 0.4.13__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.
- {thoth_dbmanager-0.4.9/thoth_dbmanager.egg-info → thoth_dbmanager-0.4.13}/PKG-INFO +2 -2
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/pyproject.toml +2 -2
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/core/registry.py +14 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/sqlite.py +62 -15
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13/thoth_dbmanager.egg-info}/PKG-INFO +2 -2
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager.egg-info/requires.txt +1 -1
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/LICENSE +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/MANIFEST.in +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/README.md +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/setup.cfg +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_integration_new_architecture.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_lsh_query.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_new_architecture.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_parameter_validation.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_thoth_db_manager_base.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_thoth_informix_manager.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_thoth_mariadb_manager.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_thoth_mysql_manager.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_thoth_oracle_manager.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_thoth_pg_manager.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_thoth_sqlite_manager.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_thoth_sqlserver_manager.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/tests/test_thoth_supabase_manager.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/ThothDbManager.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/__init__.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/__init__.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/mariadb.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/mysql.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/oracle.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/postgresql.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/sqlite.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/sqlserver.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/supabase.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/core/__init__.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/core/factory.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/core/interfaces.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/documents.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/dynamic_imports.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/__init__.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/multi_db_generator.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/preprocess_values.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/schema.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/search.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/lsh/__init__.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/lsh/core.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/lsh/factory.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/lsh/manager.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/lsh/storage.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/__init__.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/mariadb.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/mysql.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/oracle.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/postgresql.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/sqlserver.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/supabase.py +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager.egg-info/SOURCES.txt +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager.egg-info/dependency_links.txt +0 -0
- {thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: thoth_dbmanager
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.13
|
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"
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "thoth_dbmanager"
|
7
|
-
version = "0.4.
|
7
|
+
version = "0.4.13"
|
8
8
|
authors = [
|
9
9
|
{ name="Marco Pancotti", email="mp@tylconsulting.it" },
|
10
10
|
]
|
@@ -40,7 +40,7 @@ mysql = ["mysql-connector-python>=8.0.0"]
|
|
40
40
|
mariadb = ["mariadb>=1.1.0"]
|
41
41
|
sqlserver = ["pyodbc>=4.0.0", "pymssql>=2.3.0"]
|
42
42
|
oracle = ["cx_Oracle>=8.3.0", "oracledb>=3.0.0"]
|
43
|
-
supabase = ["supabase>=2.0.0", "postgrest-py>=0.10.0", "gotrue
|
43
|
+
supabase = ["supabase>=2.0.0", "postgrest-py>=0.10.0", "gotrue>=1.0.0"]
|
44
44
|
sqlite = []
|
45
45
|
|
46
46
|
# Convenience groups
|
@@ -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
|
|
@@ -75,30 +75,77 @@ class SQLitePlugin(DbPlugin):
|
|
75
75
|
# Handle database path resolution
|
76
76
|
database_path = kwargs.get('database_path')
|
77
77
|
database_name = kwargs.get('database_name')
|
78
|
-
|
78
|
+
|
79
79
|
if not database_path and database_name:
|
80
80
|
# Create database path from name and root path
|
81
81
|
db_root = Path(self.db_root_path)
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
|
83
|
+
# Handle local development case where db_root_path might be Docker path
|
84
|
+
# but we're running locally - check for data subdirectory
|
85
|
+
potential_roots = [
|
86
|
+
db_root, # Original path (e.g., /app/data)
|
87
|
+
Path.cwd() / "data", # Current working directory + data
|
88
|
+
Path(self.db_root_path).parent / "data" if self.db_root_path != "/app/data" else Path.cwd() / "data"
|
89
|
+
]
|
90
|
+
|
91
|
+
database_path = None
|
92
|
+
|
93
|
+
# Try each potential root directory
|
94
|
+
for root in potential_roots:
|
95
|
+
if not root.exists():
|
96
|
+
continue
|
97
|
+
|
98
|
+
db_dir = root / f"{self.db_mode}_databases" / database_name
|
99
|
+
|
100
|
+
# Check for existing database files with different extensions
|
101
|
+
potential_files = [
|
102
|
+
db_dir / f"{database_name}.sqlite",
|
103
|
+
db_dir / f"{database_name}.db",
|
104
|
+
db_dir / f"{database_name}.sqlite3"
|
105
|
+
]
|
106
|
+
|
107
|
+
for potential_file in potential_files:
|
108
|
+
if potential_file.exists():
|
109
|
+
database_path = str(potential_file)
|
110
|
+
logger.info(f"Found existing database file: {database_path}")
|
111
|
+
break
|
112
|
+
|
113
|
+
if database_path:
|
114
|
+
break
|
115
|
+
|
116
|
+
# If no existing file found, use the first valid root and create directory
|
117
|
+
if not database_path:
|
118
|
+
# Use the first existing root, or cwd/data as fallback
|
119
|
+
for root in potential_roots:
|
120
|
+
if root.exists():
|
121
|
+
db_root = root
|
122
|
+
break
|
123
|
+
else:
|
124
|
+
db_root = Path.cwd() / "data"
|
125
|
+
|
126
|
+
db_dir = db_root / f"{self.db_mode}_databases" / database_name
|
127
|
+
db_dir.mkdir(parents=True, exist_ok=True)
|
128
|
+
database_path = str(db_dir / f"{database_name}.sqlite")
|
129
|
+
logger.info(f"No existing database found, will use: {database_path}")
|
130
|
+
|
85
131
|
kwargs['database_path'] = database_path
|
86
|
-
|
87
|
-
# Set database path for adapter
|
132
|
+
|
133
|
+
# Set database path for adapter - ensure we use the provided database_path
|
88
134
|
self.database_path = database_path
|
89
|
-
|
90
|
-
#
|
91
|
-
super().initialize(**kwargs)
|
92
|
-
|
93
|
-
# Set up database directory path and ID
|
135
|
+
|
136
|
+
# Set up database directory path and ID before calling super().initialize()
|
94
137
|
if database_name:
|
95
138
|
self.db_id = database_name
|
96
139
|
else:
|
97
140
|
# Extract database name from path
|
98
|
-
self.db_id = Path(database_path).stem
|
99
|
-
|
100
|
-
self.
|
101
|
-
|
141
|
+
self.db_id = Path(database_path).stem if database_path else None
|
142
|
+
|
143
|
+
if self.db_id:
|
144
|
+
self._setup_directory_path(self.db_id)
|
145
|
+
|
146
|
+
# Initialize with updated kwargs - this will create and connect the adapter
|
147
|
+
super().initialize(**kwargs)
|
148
|
+
|
102
149
|
logger.info(f"SQLite plugin initialized for database: {self.db_id} at {self.database_path}")
|
103
150
|
|
104
151
|
def _setup_directory_path(self, db_id: str) -> None:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: thoth_dbmanager
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.13
|
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"
|
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
|
{thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/multi_db_generator.py
RENAMED
File without changes
|
{thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/preprocess_values.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
|
{thoth_dbmanager-0.4.9 → thoth_dbmanager-0.4.13}/thoth_dbmanager.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|