thoth-dbmanager 0.4.8__tar.gz → 0.4.10__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.8/thoth_dbmanager.egg-info → thoth_dbmanager-0.4.10}/PKG-INFO +1 -1
  2. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/pyproject.toml +1 -1
  3. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/core/interfaces.py +11 -1
  4. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/lsh/manager.py +5 -1
  5. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/lsh/storage.py +23 -10
  6. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/plugins/sqlite.py +13 -12
  7. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10/thoth_dbmanager.egg-info}/PKG-INFO +1 -1
  8. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/LICENSE +0 -0
  9. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/MANIFEST.in +0 -0
  10. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/README.md +0 -0
  11. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/setup.cfg +0 -0
  12. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_integration_new_architecture.py +0 -0
  13. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_lsh_query.py +0 -0
  14. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_new_architecture.py +0 -0
  15. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_parameter_validation.py +0 -0
  16. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_thoth_db_manager_base.py +0 -0
  17. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_thoth_informix_manager.py +0 -0
  18. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_thoth_mariadb_manager.py +0 -0
  19. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_thoth_mysql_manager.py +0 -0
  20. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_thoth_oracle_manager.py +0 -0
  21. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_thoth_pg_manager.py +0 -0
  22. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_thoth_sqlite_manager.py +0 -0
  23. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_thoth_sqlserver_manager.py +0 -0
  24. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/tests/test_thoth_supabase_manager.py +0 -0
  25. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/ThothDbManager.py +0 -0
  26. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/__init__.py +0 -0
  27. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/adapters/__init__.py +0 -0
  28. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/adapters/mariadb.py +0 -0
  29. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/adapters/mysql.py +0 -0
  30. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/adapters/oracle.py +0 -0
  31. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/adapters/postgresql.py +0 -0
  32. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/adapters/sqlite.py +0 -0
  33. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/adapters/sqlserver.py +0 -0
  34. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/adapters/supabase.py +0 -0
  35. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/core/__init__.py +0 -0
  36. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/core/factory.py +0 -0
  37. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/core/registry.py +0 -0
  38. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/documents.py +0 -0
  39. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/dynamic_imports.py +0 -0
  40. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/helpers/__init__.py +0 -0
  41. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/helpers/multi_db_generator.py +0 -0
  42. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/helpers/preprocess_values.py +0 -0
  43. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/helpers/schema.py +0 -0
  44. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/helpers/search.py +0 -0
  45. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/lsh/__init__.py +0 -0
  46. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/lsh/core.py +0 -0
  47. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/lsh/factory.py +0 -0
  48. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/plugins/__init__.py +0 -0
  49. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/plugins/mariadb.py +0 -0
  50. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/plugins/mysql.py +0 -0
  51. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/plugins/oracle.py +0 -0
  52. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/plugins/postgresql.py +0 -0
  53. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/plugins/sqlserver.py +0 -0
  54. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager/plugins/supabase.py +0 -0
  55. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager.egg-info/SOURCES.txt +0 -0
  56. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager.egg-info/dependency_links.txt +0 -0
  57. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/thoth_dbmanager.egg-info/requires.txt +0 -0
  58. {thoth_dbmanager-0.4.8 → thoth_dbmanager-0.4.10}/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.8
3
+ Version: 0.4.10
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "thoth_dbmanager"
7
- version = "0.4.8"
7
+ version = "0.4.10"
8
8
  authors = [
9
9
  { name="Marco Pancotti", email="mp@tylconsulting.it" },
10
10
  ]
@@ -143,7 +143,7 @@ class DbPlugin(ABC):
143
143
  def __init__(self, db_root_path: str, db_mode: str = "dev", **kwargs):
144
144
  """
145
145
  Initialize the database plugin.
146
-
146
+
147
147
  Args:
148
148
  db_root_path: Path to the database root directory
149
149
  db_mode: Database mode (dev, prod, etc.)
@@ -153,6 +153,16 @@ class DbPlugin(ABC):
153
153
  self.db_mode = db_mode
154
154
  self.adapter: Optional[DbAdapter] = None
155
155
  self._initialized = False
156
+
157
+ @property
158
+ def db_type(self) -> str:
159
+ """
160
+ Get the primary database type for this plugin.
161
+
162
+ Returns:
163
+ The first supported database type, or "unknown" if none specified
164
+ """
165
+ return self.supported_db_types[0] if self.supported_db_types else "unknown"
156
166
 
157
167
  @abstractmethod
158
168
  def create_adapter(self, **kwargs) -> DbAdapter:
@@ -100,10 +100,14 @@ class LshManager:
100
100
  if not self.storage_strategy.exists(self.lsh_base_path):
101
101
  # Show the actual file paths being checked for better debugging
102
102
  lsh_file = self.lsh_base_path.with_suffix('.pkl')
103
- minhashes_file = self.lsh_base_path.parent / f"{self.lsh_base_path.stem}_minhashes.pkl"
103
+ # Use the old naming convention for minhashes file
104
+ db_id = self.lsh_base_path.stem.replace('_lsh', '') if self.lsh_base_path.stem.endswith('_lsh') else self.lsh_base_path.stem
105
+ minhashes_file = self.lsh_base_path.parent / f"{db_id}_minhashes.pkl"
106
+ unique_values_file = self.lsh_base_path.parent / f"{db_id}_unique_values.pkl"
104
107
  logging.warning(f"LSH files not found. Expected files:")
105
108
  logging.warning(f" LSH file: {lsh_file}")
106
109
  logging.warning(f" Minhashes file: {minhashes_file}")
110
+ logging.warning(f" Unique values file: {unique_values_file}")
107
111
  return False
108
112
 
109
113
  lsh_data, minhashes_data = self.storage_strategy.load(self.lsh_base_path)
@@ -56,15 +56,19 @@ class PickleStorage(LshStorageStrategy):
56
56
  def save(self, lsh_data: Any, minhashes_data: Any, base_path: Path) -> None:
57
57
  """Save LSH data using pickle format."""
58
58
  lsh_path = base_path.with_suffix('.pkl')
59
- minhashes_path = base_path.parent / f"{base_path.stem}_minhashes.pkl"
60
-
59
+
60
+ # Use the old naming convention: {db_id}_minhashes.pkl instead of {db_id}_lsh_minhashes.pkl
61
+ # Extract db_id from base_path stem (remove _lsh suffix if present)
62
+ db_id = base_path.stem.replace('_lsh', '') if base_path.stem.endswith('_lsh') else base_path.stem
63
+ minhashes_path = base_path.parent / f"{db_id}_minhashes.pkl"
64
+
61
65
  # Ensure directory exists
62
66
  base_path.parent.mkdir(parents=True, exist_ok=True)
63
-
67
+
64
68
  # Save LSH data
65
69
  with open(lsh_path, 'wb') as f:
66
70
  pickle.dump(lsh_data, f)
67
-
71
+
68
72
  # Save minhashes data
69
73
  with open(minhashes_path, 'wb') as f:
70
74
  pickle.dump(minhashes_data, f)
@@ -72,32 +76,41 @@ class PickleStorage(LshStorageStrategy):
72
76
  def load(self, base_path: Path) -> Tuple[Optional[Any], Optional[Any]]:
73
77
  """Load LSH data from pickle files."""
74
78
  lsh_path = base_path.with_suffix('.pkl')
75
- minhashes_path = base_path.parent / f"{base_path.stem}_minhashes.pkl"
76
-
79
+
80
+ # Use the old naming convention: {db_id}_minhashes.pkl instead of {db_id}_lsh_minhashes.pkl
81
+ # Extract db_id from base_path stem (remove _lsh suffix if present)
82
+ db_id = base_path.stem.replace('_lsh', '') if base_path.stem.endswith('_lsh') else base_path.stem
83
+ minhashes_path = base_path.parent / f"{db_id}_minhashes.pkl"
84
+
77
85
  try:
78
86
  # Load LSH data
79
87
  with open(lsh_path, 'rb') as f:
80
88
  lsh_data = pickle.load(f)
81
-
89
+
82
90
  # Load minhashes data
83
91
  with open(minhashes_path, 'rb') as f:
84
92
  minhashes_data = pickle.load(f)
85
-
93
+
86
94
  return lsh_data, minhashes_data
87
-
95
+
88
96
  except (FileNotFoundError, pickle.PickleError):
89
97
  return None, None
90
98
 
91
99
  def exists(self, base_path: Path) -> bool:
92
100
  """Check if both LSH and minhashes pickle files exist."""
93
101
  lsh_path = base_path.with_suffix('.pkl')
94
- minhashes_path = base_path.parent / f"{base_path.stem}_minhashes.pkl"
102
+
103
+ # Use the old naming convention: {db_id}_minhashes.pkl instead of {db_id}_lsh_minhashes.pkl
104
+ # Extract db_id from base_path stem (remove _lsh suffix if present)
105
+ db_id = base_path.stem.replace('_lsh', '') if base_path.stem.endswith('_lsh') else base_path.stem
106
+ minhashes_path = base_path.parent / f"{db_id}_minhashes.pkl"
95
107
 
96
108
  # Add debug logging to help diagnose path issues
97
109
  import logging
98
110
  logger = logging.getLogger(__name__)
99
111
  logger.debug(f"Checking LSH files existence:")
100
112
  logger.debug(f" Base path: {base_path}")
113
+ logger.debug(f" DB ID: {db_id}")
101
114
  logger.debug(f" LSH path: {lsh_path} (exists: {lsh_path.exists()})")
102
115
  logger.debug(f" Minhashes path: {minhashes_path} (exists: {minhashes_path.exists()})")
103
116
 
@@ -75,7 +75,7 @@ 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)
@@ -83,22 +83,23 @@ class SQLitePlugin(DbPlugin):
83
83
  db_dir.mkdir(parents=True, exist_ok=True)
84
84
  database_path = str(db_dir / f"{database_name}.db")
85
85
  kwargs['database_path'] = database_path
86
-
87
- # Set database path for adapter
86
+
87
+ # Set database path for adapter - ensure we use the provided database_path
88
88
  self.database_path = database_path
89
-
90
- # Initialize with updated kwargs
91
- super().initialize(**kwargs)
92
-
93
- # Set up database directory path and ID
89
+
90
+ # Set up database directory path and ID before calling super().initialize()
94
91
  if database_name:
95
92
  self.db_id = database_name
96
93
  else:
97
94
  # Extract database name from path
98
- self.db_id = Path(database_path).stem
99
-
100
- self._setup_directory_path(self.db_id)
101
-
95
+ self.db_id = Path(database_path).stem if database_path else None
96
+
97
+ if self.db_id:
98
+ self._setup_directory_path(self.db_id)
99
+
100
+ # Initialize with updated kwargs - this will create and connect the adapter
101
+ super().initialize(**kwargs)
102
+
102
103
  logger.info(f"SQLite plugin initialized for database: {self.db_id} at {self.database_path}")
103
104
 
104
105
  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.8
3
+ Version: 0.4.10
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