thoth-dbmanager 0.5.3__py3-none-any.whl → 0.5.9__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.
Files changed (35) hide show
  1. thoth_dbmanager/ThothDbManager.py +14 -0
  2. thoth_dbmanager/__init__.py +15 -1
  3. thoth_dbmanager/adapters/__init__.py +44 -6
  4. thoth_dbmanager/adapters/mariadb.py +361 -129
  5. thoth_dbmanager/adapters/postgresql.py +49 -23
  6. thoth_dbmanager/adapters/sqlite.py +14 -1
  7. thoth_dbmanager/adapters/sqlserver.py +38 -9
  8. thoth_dbmanager/core/__init__.py +14 -0
  9. thoth_dbmanager/core/factory.py +17 -0
  10. thoth_dbmanager/core/interfaces.py +14 -0
  11. thoth_dbmanager/core/registry.py +14 -0
  12. thoth_dbmanager/documents.py +14 -0
  13. thoth_dbmanager/dynamic_imports.py +14 -0
  14. thoth_dbmanager/helpers/__init__.py +13 -0
  15. thoth_dbmanager/helpers/multi_db_generator.py +14 -0
  16. thoth_dbmanager/helpers/preprocess_values.py +14 -0
  17. thoth_dbmanager/helpers/schema.py +14 -0
  18. thoth_dbmanager/helpers/search.py +14 -0
  19. thoth_dbmanager/lsh/__init__.py +14 -0
  20. thoth_dbmanager/lsh/core.py +14 -0
  21. thoth_dbmanager/lsh/factory.py +14 -0
  22. thoth_dbmanager/lsh/manager.py +14 -0
  23. thoth_dbmanager/lsh/storage.py +14 -0
  24. thoth_dbmanager/plugins/__init__.py +47 -8
  25. thoth_dbmanager/plugins/mariadb.py +41 -251
  26. thoth_dbmanager/plugins/postgresql.py +14 -0
  27. thoth_dbmanager/plugins/sqlite.py +14 -0
  28. thoth_dbmanager/plugins/sqlserver.py +14 -0
  29. {thoth_dbmanager-0.5.3.dist-info → thoth_dbmanager-0.5.9.dist-info}/METADATA +2 -1
  30. thoth_dbmanager-0.5.9.dist-info/RECORD +34 -0
  31. thoth_dbmanager-0.5.9.dist-info/licenses/LICENSE.md +21 -0
  32. thoth_dbmanager-0.5.3.dist-info/RECORD +0 -33
  33. {thoth_dbmanager-0.5.3.dist-info → thoth_dbmanager-0.5.9.dist-info}/WHEEL +0 -0
  34. {thoth_dbmanager-0.5.3.dist-info → thoth_dbmanager-0.5.9.dist-info}/licenses/LICENSE +0 -0
  35. {thoth_dbmanager-0.5.3.dist-info → thoth_dbmanager-0.5.9.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  PostgreSQL adapter implementation.
3
17
  """
@@ -29,6 +43,8 @@ class PostgreSQLAdapter(DbAdapter):
29
43
  super().__init__(connection_params)
30
44
  self.engine = None
31
45
  self.raw_connection = None
46
+ # Schema support (default 'public')
47
+ self.schema = connection_params.get('schema', 'public')
32
48
 
33
49
  def connect(self) -> None:
34
50
  """Establish PostgreSQL connection"""
@@ -129,19 +145,23 @@ class PostgreSQLAdapter(DbAdapter):
129
145
 
130
146
  def get_tables_as_documents(self) -> List[TableDocument]:
131
147
  """Get tables as document objects"""
148
+ # Use pg_catalog to avoid requiring SELECT privileges on tables
149
+ # relkind: 'r' = ordinary table, 'p' = partitioned table
132
150
  query = """
133
151
  SELECT
134
- schemaname as schema_name,
135
- tablename as table_name,
136
- COALESCE(obj_description(c.oid), '') as comment
137
- FROM pg_tables pt
138
- LEFT JOIN pg_class c ON c.relname = pt.tablename
139
- LEFT JOIN pg_namespace n ON n.oid = c.relnamespace AND n.nspname = pt.schemaname
140
- WHERE schemaname NOT IN ('information_schema', 'pg_catalog', 'pg_toast')
141
- ORDER BY schemaname, tablename
152
+ n.nspname AS schema_name,
153
+ c.relname AS table_name,
154
+ COALESCE(d.description, '') AS comment
155
+ FROM pg_class c
156
+ JOIN pg_namespace n ON n.oid = c.relnamespace
157
+ LEFT JOIN pg_description d ON d.objoid = c.oid AND d.objsubid = 0
158
+ WHERE c.relkind IN ('r','p')
159
+ AND n.nspname = :schema
160
+ AND n.nspname NOT IN ('pg_catalog','information_schema','pg_toast')
161
+ ORDER BY c.relname
142
162
  """
143
163
 
144
- results = self.execute_query(query)
164
+ results = self.execute_query(query, {"schema": self.schema})
145
165
  documents = []
146
166
 
147
167
  for row in results:
@@ -179,10 +199,11 @@ class PostgreSQLAdapter(DbAdapter):
179
199
  ) pk ON pk.column_name = c.column_name AND pk.table_name = c.table_name AND pk.table_schema = c.table_schema
180
200
  WHERE c.table_name = :table_name
181
201
  AND c.table_schema NOT IN ('information_schema', 'pg_catalog')
202
+ AND c.table_schema = :schema
182
203
  ORDER BY c.ordinal_position
183
204
  """
184
205
 
185
- results = self.execute_query(query, {"table_name": table_name})
206
+ results = self.execute_query(query, {"table_name": table_name, "schema": self.schema})
186
207
  documents = []
187
208
 
188
209
  for row in results:
@@ -205,21 +226,26 @@ class PostgreSQLAdapter(DbAdapter):
205
226
  """Get foreign keys as document objects"""
206
227
  query = """
207
228
  SELECT
208
- tc.constraint_name,
209
- tc.table_schema as schema_name,
210
- tc.table_name as source_table,
211
- kcu.column_name as source_column,
212
- ccu.table_name as target_table,
213
- ccu.column_name as target_column
214
- FROM information_schema.table_constraints tc
215
- JOIN information_schema.key_column_usage kcu ON tc.constraint_name = kcu.constraint_name
216
- JOIN information_schema.constraint_column_usage ccu ON ccu.constraint_name = tc.constraint_name
217
- WHERE tc.constraint_type = 'FOREIGN KEY'
218
- AND tc.table_schema NOT IN ('information_schema', 'pg_catalog')
219
- ORDER BY tc.table_schema, tc.table_name, kcu.ordinal_position
229
+ con.conname AS constraint_name,
230
+ ns.nspname AS schema_name,
231
+ rel.relname AS source_table,
232
+ a.attname AS source_column,
233
+ frel.relname AS target_table,
234
+ fa.attname AS target_column
235
+ FROM pg_constraint con
236
+ JOIN pg_class rel ON rel.oid = con.conrelid
237
+ JOIN pg_namespace ns ON ns.oid = rel.relnamespace
238
+ JOIN pg_class frel ON frel.oid = con.confrelid
239
+ JOIN unnest(con.conkey) WITH ORDINALITY AS src(attnum, ord) ON true
240
+ JOIN pg_attribute a ON a.attrelid = con.conrelid AND a.attnum = src.attnum
241
+ JOIN unnest(con.confkey) WITH ORDINALITY AS dst(attnum, ord) ON dst.ord = src.ord
242
+ JOIN pg_attribute fa ON fa.attrelid = con.confrelid AND fa.attnum = dst.attnum
243
+ WHERE con.contype = 'f'
244
+ AND ns.nspname = :schema
245
+ ORDER BY ns.nspname, rel.relname, src.ord
220
246
  """
221
247
 
222
- results = self.execute_query(query)
248
+ results = self.execute_query(query, {"schema": self.schema})
223
249
  documents = []
224
250
 
225
251
  for row in results:
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  SQLite adapter implementation.
3
17
  """
@@ -206,7 +220,6 @@ class SQLiteAdapter(DbAdapter):
206
220
 
207
221
  def get_schemas_as_documents(self) -> List[SchemaDocument]:
208
222
  """Get schemas as document objects"""
209
- # SQLite has limited schema support, mainly 'main', 'temp', and attached databases
210
223
  query = "PRAGMA database_list"
211
224
 
212
225
  results = self.execute_query(query)
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  SQL Server adapter implementation.
3
17
  """
@@ -23,6 +37,7 @@ class SQLServerAdapter(DbAdapter):
23
37
  self.database = connection_params.get('database')
24
38
  self.user = connection_params.get('user')
25
39
  self.password = connection_params.get('password')
40
+ self.schema = connection_params.get('schema', 'dbo') # Default to 'dbo' for SQL Server
26
41
  self.driver = connection_params.get('driver', 'ODBC Driver 17 for SQL Server')
27
42
 
28
43
  def connect(self) -> None:
@@ -142,10 +157,11 @@ class SQLServerAdapter(DbAdapter):
142
157
 
143
158
  def get_tables(self) -> List[str]:
144
159
  """Get list of tables in the database."""
145
- query = """
160
+ query = f"""
146
161
  SELECT TABLE_NAME as name
147
162
  FROM INFORMATION_SCHEMA.TABLES
148
163
  WHERE TABLE_TYPE = 'BASE TABLE'
164
+ AND TABLE_SCHEMA = '{self.schema}'
149
165
  ORDER BY TABLE_NAME
150
166
  """
151
167
  result = self.execute_query(query)
@@ -159,15 +175,17 @@ class SQLServerAdapter(DbAdapter):
159
175
  DATA_TYPE as type,
160
176
  IS_NULLABLE as nullable,
161
177
  COLUMN_DEFAULT as default_value,
162
- CASE WHEN COLUMNPROPERTY(OBJECT_ID(TABLE_NAME), COLUMN_NAME, 'IsIdentity') = 1 THEN 1 ELSE 0 END as is_identity,
178
+ CASE WHEN COLUMNPROPERTY(OBJECT_ID('{self.schema}.' + TABLE_NAME), COLUMN_NAME, 'IsIdentity') = 1 THEN 1 ELSE 0 END as is_identity,
163
179
  CASE WHEN EXISTS (
164
180
  SELECT 1 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
165
181
  WHERE TABLE_NAME = '{table_name}'
182
+ AND TABLE_SCHEMA = '{self.schema}'
166
183
  AND COLUMN_NAME = c.COLUMN_NAME
167
184
  AND CONSTRAINT_NAME LIKE 'PK_%'
168
185
  ) THEN 1 ELSE 0 END as is_primary_key
169
186
  FROM INFORMATION_SCHEMA.COLUMNS c
170
187
  WHERE TABLE_NAME = '{table_name}'
188
+ AND TABLE_SCHEMA = '{self.schema}'
171
189
  ORDER BY ORDINAL_POSITION
172
190
  """
173
191
 
@@ -255,6 +273,7 @@ class SQLServerAdapter(DbAdapter):
255
273
  SELECT COUNT(*) as count
256
274
  FROM INFORMATION_SCHEMA.TABLES
257
275
  WHERE TABLE_NAME = '{table_name}'
276
+ AND TABLE_SCHEMA = '{self.schema}'
258
277
  AND TABLE_TYPE = 'BASE TABLE'
259
278
  """
260
279
  result = self.execute_query(query)
@@ -276,13 +295,14 @@ class SQLServerAdapter(DbAdapter):
276
295
  if not self.engine:
277
296
  raise RuntimeError("Not connected to database")
278
297
 
279
- query = """
298
+ query = f"""
280
299
  SELECT
281
300
  TABLE_NAME as name,
282
301
  TABLE_SCHEMA as schema_name,
283
302
  '' as comment
284
303
  FROM INFORMATION_SCHEMA.TABLES
285
304
  WHERE TABLE_TYPE = 'BASE TABLE'
305
+ AND TABLE_SCHEMA = '{self.schema}'
286
306
  ORDER BY TABLE_NAME
287
307
  """
288
308
 
@@ -323,9 +343,10 @@ class SQLServerAdapter(DbAdapter):
323
343
  """Get example data (most frequent values) for each column in a table."""
324
344
  inspector = inspect(self.engine)
325
345
  try:
326
- columns = inspector.get_columns(table_name)
346
+ # For SQL Server, we need to specify the schema when inspecting columns
347
+ columns = inspector.get_columns(table_name, schema=self.schema)
327
348
  except SQLAlchemyError as e:
328
- logger.error(f"Error inspecting columns for table {table_name}: {e}")
349
+ logger.error(f"Error inspecting columns for table {table_name} in schema {self.schema}: {e}")
329
350
  raise e
330
351
 
331
352
  if not columns:
@@ -374,16 +395,18 @@ class SQLServerAdapter(DbAdapter):
374
395
  CASE WHEN EXISTS (
375
396
  SELECT 1 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
376
397
  WHERE TABLE_NAME = c.TABLE_NAME
398
+ AND TABLE_SCHEMA = c.TABLE_SCHEMA
377
399
  AND COLUMN_NAME = c.COLUMN_NAME
378
400
  AND CONSTRAINT_NAME LIKE 'PK_%'
379
401
  ) THEN 1 ELSE 0 END as is_primary_key
380
402
  FROM INFORMATION_SCHEMA.COLUMNS c
381
403
  WHERE c.TABLE_NAME = '{table_name}'
404
+ AND c.TABLE_SCHEMA = '{self.schema}'
382
405
  ORDER BY c.ORDINAL_POSITION
383
406
  """
384
407
  else:
385
408
  # Get all columns
386
- query = """
409
+ query = f"""
387
410
  SELECT
388
411
  c.TABLE_NAME as table_name,
389
412
  c.COLUMN_NAME as column_name,
@@ -394,10 +417,12 @@ class SQLServerAdapter(DbAdapter):
394
417
  CASE WHEN EXISTS (
395
418
  SELECT 1 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
396
419
  WHERE TABLE_NAME = c.TABLE_NAME
420
+ AND TABLE_SCHEMA = c.TABLE_SCHEMA
397
421
  AND COLUMN_NAME = c.COLUMN_NAME
398
422
  AND CONSTRAINT_NAME LIKE 'PK_%'
399
423
  ) THEN 1 ELSE 0 END as is_primary_key
400
424
  FROM INFORMATION_SCHEMA.COLUMNS c
425
+ WHERE c.TABLE_SCHEMA = '{self.schema}'
401
426
  ORDER BY c.TABLE_NAME, c.ORDINAL_POSITION
402
427
  """
403
428
 
@@ -445,7 +470,7 @@ class SQLServerAdapter(DbAdapter):
445
470
  raise RuntimeError("Not connected to database")
446
471
 
447
472
  if table_name:
448
- where_clause = f"WHERE t.name = '{table_name}'"
473
+ where_clause = f"AND t.name = '{table_name}'"
449
474
  else:
450
475
  where_clause = ""
451
476
 
@@ -461,6 +486,8 @@ class SQLServerAdapter(DbAdapter):
461
486
  JOIN sys.columns c ON fkc.parent_object_id = c.object_id AND fkc.parent_column_id = c.column_id
462
487
  JOIN sys.columns rc ON fkc.referenced_object_id = rc.object_id AND fkc.referenced_column_id = rc.column_id
463
488
  JOIN sys.tables t ON fk.parent_object_id = t.object_id
489
+ JOIN sys.schemas s ON t.schema_id = s.schema_id
490
+ WHERE s.name = '{self.schema}'
464
491
  {where_clause}
465
492
  ORDER BY fk.name
466
493
  """
@@ -503,7 +530,7 @@ class SQLServerAdapter(DbAdapter):
503
530
  raise RuntimeError("Not connected to database")
504
531
 
505
532
  if table_name:
506
- where_clause = f"WHERE t.name = '{table_name}'"
533
+ where_clause = f"AND t.name = '{table_name}'"
507
534
  else:
508
535
  where_clause = ""
509
536
 
@@ -518,8 +545,10 @@ class SQLServerAdapter(DbAdapter):
518
545
  JOIN sys.index_columns ic ON i.object_id = ic.object_id AND i.index_id = ic.index_id
519
546
  JOIN sys.columns c ON ic.object_id = c.object_id AND ic.column_id = c.column_id
520
547
  JOIN sys.tables t ON i.object_id = t.object_id
548
+ JOIN sys.schemas s ON t.schema_id = s.schema_id
549
+ WHERE s.name = '{self.schema}'
521
550
  {where_clause}
522
- WHERE i.name IS NOT NULL
551
+ AND i.name IS NOT NULL
523
552
  ORDER BY i.name, ic.key_ordinal
524
553
  """
525
554
 
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  Core components for Thoth SQL Database Manager.
3
17
  """
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  Factory for creating database manager instances with plugin support.
3
17
  """
@@ -6,6 +20,9 @@ from typing import Any, Dict, List, Optional
6
20
  from .registry import DbPluginRegistry
7
21
  from .interfaces import DbPlugin
8
22
 
23
+ # Import plugins to ensure they are registered
24
+ from .. import plugins # This imports all plugins and registers them
25
+
9
26
  logger = logging.getLogger(__name__)
10
27
 
11
28
 
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  Abstract interfaces for database plugins and adapters.
3
17
  """
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  Plugin registry system for database plugins.
3
17
  """
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  Document models for Thoth SQL Database Manager.
3
17
  Provides type-safe document structures similar to thoth_vdb architecture.
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  Dynamic import system for database-specific functionality.
3
17
  This module provides lazy loading of database managers and adapters.
@@ -0,0 +1,13 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  import logging
2
16
  import random
3
17
  import re
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  import logging
2
16
  import pickle
3
17
  from pathlib import Path
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  import logging
2
16
  from dataclasses import dataclass, field
3
17
  from typing import Any, Dict, List, Optional, Tuple
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  import logging
2
16
  import pickle
3
17
  from pathlib import Path
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  LSH (Locality Sensitive Hashing) module for database-independent LSH management.
3
17
  """
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  Core LSH functionality extracted from helpers.
3
17
  """
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  Factory for creating LSH indices from database managers.
3
17
  """
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  LSH Manager for database-independent LSH operations.
3
17
  """
@@ -1,3 +1,17 @@
1
+ # Copyright 2025 Marco Pancotti
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """
2
16
  Storage strategies for LSH data persistence.
3
17
  """