thoth-dbmanager 0.4.11__py3-none-any.whl → 0.4.12__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.
@@ -79,24 +79,51 @@ 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
82
 
84
- # Check for existing database files with different extensions
85
- potential_files = [
86
- db_dir / f"{database_name}.sqlite",
87
- db_dir / f"{database_name}.db",
88
- db_dir / f"{database_name}.sqlite3"
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
89
  ]
90
90
 
91
91
  database_path = None
92
- for potential_file in potential_files:
93
- if potential_file.exists():
94
- database_path = str(potential_file)
95
- logger.info(f"Found existing database file: {database_path}")
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:
96
114
  break
97
115
 
98
- # If no existing file found, create directory and use .sqlite extension
116
+ # If no existing file found, use the first valid root and create directory
99
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
100
127
  db_dir.mkdir(parents=True, exist_ok=True)
101
128
  database_path = str(db_dir / f"{database_name}.sqlite")
102
129
  logger.info(f"No existing database found, will use: {database_path}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thoth_dbmanager
3
- Version: 0.4.11
3
+ Version: 0.4.12
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
@@ -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=BVj6OXpihSNlkEXYo_xwA53ulQYR8WjU_JBXdJJhwqA,7464
32
+ thoth_dbmanager/plugins/sqlite.py,sha256=ATWubLiLBL04Xjk24oUcZP5rQhksDZVfCwySrLRekiY,8654
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.4.11.dist-info/licenses/LICENSE,sha256=81-BOzGgwtY1XdYfkwMQB87AkOGXI9OMq0kjNcZA4UE,1071
36
- thoth_dbmanager-0.4.11.dist-info/METADATA,sha256=wJLpWBVuZ8bjJXjlwsL64CLmarCfl_HWKxHyUbjmCXs,12247
37
- thoth_dbmanager-0.4.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- thoth_dbmanager-0.4.11.dist-info/top_level.txt,sha256=b9ttxm9RUc0KUCASEKRx6FqoREYJ1-KZWSpNuaM0uQ4,16
39
- thoth_dbmanager-0.4.11.dist-info/RECORD,,
35
+ thoth_dbmanager-0.4.12.dist-info/licenses/LICENSE,sha256=81-BOzGgwtY1XdYfkwMQB87AkOGXI9OMq0kjNcZA4UE,1071
36
+ thoth_dbmanager-0.4.12.dist-info/METADATA,sha256=gT0cJyyrAYIKSdJWb8fzB-V6SZ-4FF3wss3o4E7jgHE,12247
37
+ thoth_dbmanager-0.4.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ thoth_dbmanager-0.4.12.dist-info/top_level.txt,sha256=b9ttxm9RUc0KUCASEKRx6FqoREYJ1-KZWSpNuaM0uQ4,16
39
+ thoth_dbmanager-0.4.12.dist-info/RECORD,,