thoth-dbmanager 0.4.10__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.
Files changed (58) hide show
  1. {thoth_dbmanager-0.4.10/thoth_dbmanager.egg-info → thoth_dbmanager-0.4.13}/PKG-INFO +2 -2
  2. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/pyproject.toml +2 -2
  3. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/core/registry.py +14 -0
  4. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/sqlite.py +49 -3
  5. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13/thoth_dbmanager.egg-info}/PKG-INFO +2 -2
  6. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager.egg-info/requires.txt +1 -1
  7. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/LICENSE +0 -0
  8. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/MANIFEST.in +0 -0
  9. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/README.md +0 -0
  10. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/setup.cfg +0 -0
  11. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_integration_new_architecture.py +0 -0
  12. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_lsh_query.py +0 -0
  13. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_new_architecture.py +0 -0
  14. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_parameter_validation.py +0 -0
  15. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_thoth_db_manager_base.py +0 -0
  16. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_thoth_informix_manager.py +0 -0
  17. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_thoth_mariadb_manager.py +0 -0
  18. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_thoth_mysql_manager.py +0 -0
  19. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_thoth_oracle_manager.py +0 -0
  20. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_thoth_pg_manager.py +0 -0
  21. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_thoth_sqlite_manager.py +0 -0
  22. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_thoth_sqlserver_manager.py +0 -0
  23. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/tests/test_thoth_supabase_manager.py +0 -0
  24. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/ThothDbManager.py +0 -0
  25. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/__init__.py +0 -0
  26. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/__init__.py +0 -0
  27. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/mariadb.py +0 -0
  28. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/mysql.py +0 -0
  29. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/oracle.py +0 -0
  30. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/postgresql.py +0 -0
  31. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/sqlite.py +0 -0
  32. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/sqlserver.py +0 -0
  33. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/adapters/supabase.py +0 -0
  34. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/core/__init__.py +0 -0
  35. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/core/factory.py +0 -0
  36. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/core/interfaces.py +0 -0
  37. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/documents.py +0 -0
  38. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/dynamic_imports.py +0 -0
  39. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/__init__.py +0 -0
  40. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/multi_db_generator.py +0 -0
  41. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/preprocess_values.py +0 -0
  42. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/schema.py +0 -0
  43. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/helpers/search.py +0 -0
  44. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/lsh/__init__.py +0 -0
  45. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/lsh/core.py +0 -0
  46. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/lsh/factory.py +0 -0
  47. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/lsh/manager.py +0 -0
  48. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/lsh/storage.py +0 -0
  49. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/__init__.py +0 -0
  50. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/mariadb.py +0 -0
  51. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/mysql.py +0 -0
  52. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/oracle.py +0 -0
  53. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/postgresql.py +0 -0
  54. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/sqlserver.py +0 -0
  55. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager/plugins/supabase.py +0 -0
  56. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager.egg-info/SOURCES.txt +0 -0
  57. {thoth_dbmanager-0.4.10 → thoth_dbmanager-0.4.13}/thoth_dbmanager.egg-info/dependency_links.txt +0 -0
  58. {thoth_dbmanager-0.4.10 → 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.10
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-py>=1.0.0; extra == "supabase"
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.10"
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-py>=1.0.0"]
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
 
@@ -79,9 +79,55 @@ class SQLitePlugin(DbPlugin):
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
- db_dir = db_root / f"{self.db_mode}_databases" / database_name
83
- db_dir.mkdir(parents=True, exist_ok=True)
84
- database_path = str(db_dir / f"{database_name}.db")
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
132
 
87
133
  # Set database path for adapter - ensure we use the provided database_path
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thoth_dbmanager
3
- Version: 0.4.10
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-py>=1.0.0; extra == "supabase"
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"
@@ -49,7 +49,7 @@ pymssql>=2.3.0
49
49
  [supabase]
50
50
  supabase>=2.0.0
51
51
  postgrest-py>=0.10.0
52
- gotrue-py>=1.0.0
52
+ gotrue>=1.0.0
53
53
 
54
54
  [test-mysql]
55
55
  pytest>=7.0.0