dsw-database 4.26.0rc1__tar.gz → 4.27.0__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.
- {dsw_database-4.26.0rc1/dsw_database.egg-info → dsw_database-4.27.0}/PKG-INFO +11 -11
- {dsw_database-4.26.0rc1 → dsw_database-4.27.0}/dsw/database/__init__.py +1 -0
- {dsw_database-4.26.0rc1 → dsw_database-4.27.0}/dsw/database/build_info.py +4 -4
- {dsw_database-4.26.0rc1 → dsw_database-4.27.0}/dsw/database/database.py +42 -45
- {dsw_database-4.26.0rc1 → dsw_database-4.27.0}/dsw/database/model.py +12 -2
- dsw_database-4.27.0/dsw/database/py.typed +0 -0
- dsw_database-4.27.0/pyproject.toml +40 -0
- dsw_database-4.26.0rc1/LICENSE +0 -202
- dsw_database-4.26.0rc1/PKG-INFO +0 -44
- dsw_database-4.26.0rc1/dsw_database.egg-info/SOURCES.txt +0 -14
- dsw_database-4.26.0rc1/dsw_database.egg-info/dependency_links.txt +0 -1
- dsw_database-4.26.0rc1/dsw_database.egg-info/not-zip-safe +0 -1
- dsw_database-4.26.0rc1/dsw_database.egg-info/requires.txt +0 -3
- dsw_database-4.26.0rc1/dsw_database.egg-info/top_level.txt +0 -1
- dsw_database-4.26.0rc1/pyproject.toml +0 -44
- dsw_database-4.26.0rc1/setup.cfg +0 -4
- dsw_database-4.26.0rc1/setup.py +0 -3
- {dsw_database-4.26.0rc1 → dsw_database-4.27.0}/README.md +0 -0
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: dsw-database
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.27.0
|
|
4
4
|
Summary: Library for managing DSW database
|
|
5
|
+
Keywords: dsw,database
|
|
6
|
+
Author: Marek Suchánek
|
|
5
7
|
Author-email: Marek Suchánek <marek.suchanek@ds-wizard.org>
|
|
6
8
|
License: Apache License 2.0
|
|
7
|
-
Project-URL: Homepage, https://ds-wizard.org
|
|
8
|
-
Project-URL: Repository, https://github.com/ds-wizard/engine-tools
|
|
9
|
-
Project-URL: Documentation, https://guide.ds-wizard.org
|
|
10
|
-
Keywords: dsw,database
|
|
11
9
|
Classifier: Development Status :: 5 - Production/Stable
|
|
12
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
11
|
Classifier: Programming Language :: Python
|
|
@@ -15,13 +13,15 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
15
13
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
14
|
Classifier: Topic :: Database
|
|
17
15
|
Classifier: Topic :: Utilities
|
|
18
|
-
Requires-Python: <4,>=3.12
|
|
19
|
-
Description-Content-Type: text/markdown
|
|
20
|
-
License-File: LICENSE
|
|
21
16
|
Requires-Dist: psycopg[binary]
|
|
22
17
|
Requires-Dist: tenacity
|
|
23
|
-
Requires-Dist: dsw-config==4.
|
|
24
|
-
|
|
18
|
+
Requires-Dist: dsw-config==4.27.0
|
|
19
|
+
Requires-Python: >=3.12, <4
|
|
20
|
+
Project-URL: Homepage, https://ds-wizard.org
|
|
21
|
+
Project-URL: Repository, https://github.com/ds-wizard/engine-tools
|
|
22
|
+
Project-URL: Documentation, https://guide.ds-wizard.org
|
|
23
|
+
Project-URL: Issues, https://github.com/ds-wizard/ds-wizard/issues
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
25
|
|
|
26
26
|
# Data Stewardship Wizard: Database
|
|
27
27
|
|
|
@@ -9,9 +9,9 @@ BuildInfo = namedtuple(
|
|
|
9
9
|
)
|
|
10
10
|
|
|
11
11
|
BUILD_INFO = BuildInfo(
|
|
12
|
-
version='v4.
|
|
13
|
-
built_at='2026-
|
|
14
|
-
sha='
|
|
12
|
+
version='v4.27.0~8ec71bd',
|
|
13
|
+
built_at='2026-02-03 08:44:49Z',
|
|
14
|
+
sha='8ec71bd85dfbea66adedb6590f7d76ae5143bbaa',
|
|
15
15
|
branch='HEAD',
|
|
16
|
-
tag='v4.
|
|
16
|
+
tag='v4.27.0',
|
|
17
17
|
)
|
|
@@ -11,12 +11,8 @@ import tenacity
|
|
|
11
11
|
|
|
12
12
|
from dsw.config.model import DatabaseConfig
|
|
13
13
|
|
|
14
|
-
from .
|
|
15
|
-
|
|
16
|
-
DocumentState, DBTenantLimits, DBSubmission, \
|
|
17
|
-
DBInstanceConfigMail, DBProjectSimple, \
|
|
18
|
-
DBUserEntity, DBLocale, DBDocumentTemplateFormat, \
|
|
19
|
-
DBDocumentTemplateStep
|
|
14
|
+
from . import model
|
|
15
|
+
|
|
20
16
|
|
|
21
17
|
LOG = logging.getLogger(__name__)
|
|
22
18
|
|
|
@@ -88,7 +84,7 @@ class Database:
|
|
|
88
84
|
' enabled is TRUE AND '
|
|
89
85
|
' tenant_uuid = %(tenant_uuid)s;')
|
|
90
86
|
SELECT_LOCALE = ('SELECT * FROM locale '
|
|
91
|
-
'WHERE
|
|
87
|
+
'WHERE uuid = %(locale_uuid)s AND tenant_uuid = %(tenant_uuid)s;')
|
|
92
88
|
|
|
93
89
|
def __init__(self, cfg: DatabaseConfig, connect: bool = True,
|
|
94
90
|
with_queue: bool = True):
|
|
@@ -144,7 +140,7 @@ class Database:
|
|
|
144
140
|
before=tenacity.before_log(LOG, logging.DEBUG),
|
|
145
141
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
146
142
|
)
|
|
147
|
-
def fetch_document(self, document_uuid: str, tenant_uuid: str) -> DBDocument | None:
|
|
143
|
+
def fetch_document(self, document_uuid: str, tenant_uuid: str) -> model.DBDocument | None:
|
|
148
144
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
149
145
|
cursor.execute(
|
|
150
146
|
query=self.SELECT_DOCUMENT,
|
|
@@ -153,7 +149,7 @@ class Database:
|
|
|
153
149
|
result = cursor.fetchall()
|
|
154
150
|
if len(result) != 1:
|
|
155
151
|
return None
|
|
156
|
-
return DBDocument.from_dict_row(result[0])
|
|
152
|
+
return model.DBDocument.from_dict_row(result[0])
|
|
157
153
|
|
|
158
154
|
@tenacity.retry(
|
|
159
155
|
reraise=True,
|
|
@@ -162,7 +158,7 @@ class Database:
|
|
|
162
158
|
before=tenacity.before_log(LOG, logging.DEBUG),
|
|
163
159
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
164
160
|
)
|
|
165
|
-
def fetch_tenant_limits(self, tenant_uuid: str) -> DBTenantLimits | None:
|
|
161
|
+
def fetch_tenant_limits(self, tenant_uuid: str) -> model.DBTenantLimits | None:
|
|
166
162
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
167
163
|
cursor.execute(
|
|
168
164
|
query=self.SELECT_TENANT_LIMIT,
|
|
@@ -171,7 +167,7 @@ class Database:
|
|
|
171
167
|
result = cursor.fetchall()
|
|
172
168
|
if len(result) != 1:
|
|
173
169
|
return None
|
|
174
|
-
return DBTenantLimits.from_dict_row(result[0])
|
|
170
|
+
return model.DBTenantLimits.from_dict_row(result[0])
|
|
175
171
|
|
|
176
172
|
@tenacity.retry(
|
|
177
173
|
reraise=True,
|
|
@@ -181,8 +177,8 @@ class Database:
|
|
|
181
177
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
182
178
|
)
|
|
183
179
|
def fetch_template(
|
|
184
|
-
self, template_id: str, tenant_uuid: str
|
|
185
|
-
) -> DBDocumentTemplate | None:
|
|
180
|
+
self, template_id: str, tenant_uuid: str,
|
|
181
|
+
) -> model.DBDocumentTemplate | None:
|
|
186
182
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
187
183
|
cursor.execute(
|
|
188
184
|
query=self.SELECT_TEMPLATE,
|
|
@@ -191,7 +187,7 @@ class Database:
|
|
|
191
187
|
dt_result = cursor.fetchall()
|
|
192
188
|
if len(dt_result) != 1:
|
|
193
189
|
return None
|
|
194
|
-
template = DBDocumentTemplate.from_dict_row(dt_result[0])
|
|
190
|
+
template = model.DBDocumentTemplate.from_dict_row(dt_result[0])
|
|
195
191
|
|
|
196
192
|
cursor.execute(
|
|
197
193
|
query=self.SELECT_TEMPLATE_FORMATS,
|
|
@@ -199,7 +195,7 @@ class Database:
|
|
|
199
195
|
)
|
|
200
196
|
formats_result = cursor.fetchall()
|
|
201
197
|
formats = sorted([
|
|
202
|
-
DBDocumentTemplateFormat.from_dict_row(x) for x in formats_result
|
|
198
|
+
model.DBDocumentTemplateFormat.from_dict_row(x) for x in formats_result
|
|
203
199
|
], key=lambda x: x.name)
|
|
204
200
|
cursor.execute(
|
|
205
201
|
query=self.SELECT_TEMPLATE_STEPS,
|
|
@@ -207,7 +203,7 @@ class Database:
|
|
|
207
203
|
)
|
|
208
204
|
steps_result = cursor.fetchall()
|
|
209
205
|
steps = sorted([
|
|
210
|
-
DBDocumentTemplateStep.from_dict_row(x) for x in steps_result
|
|
206
|
+
model.DBDocumentTemplateStep.from_dict_row(x) for x in steps_result
|
|
211
207
|
], key=lambda x: x.position)
|
|
212
208
|
steps_dict: dict[str, list[dict]] = {}
|
|
213
209
|
for step in steps:
|
|
@@ -233,14 +229,14 @@ class Database:
|
|
|
233
229
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
234
230
|
)
|
|
235
231
|
def fetch_template_files(
|
|
236
|
-
self, template_id: str, tenant_uuid: str
|
|
237
|
-
) -> list[DBDocumentTemplateFile]:
|
|
232
|
+
self, template_id: str, tenant_uuid: str,
|
|
233
|
+
) -> list[model.DBDocumentTemplateFile]:
|
|
238
234
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
239
235
|
cursor.execute(
|
|
240
236
|
query=self.SELECT_TEMPLATE_FILES,
|
|
241
237
|
params=(template_id, tenant_uuid),
|
|
242
238
|
)
|
|
243
|
-
return [DBDocumentTemplateFile.from_dict_row(x) for x in cursor.fetchall()]
|
|
239
|
+
return [model.DBDocumentTemplateFile.from_dict_row(x) for x in cursor.fetchall()]
|
|
244
240
|
|
|
245
241
|
@tenacity.retry(
|
|
246
242
|
reraise=True,
|
|
@@ -250,14 +246,14 @@ class Database:
|
|
|
250
246
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
251
247
|
)
|
|
252
248
|
def fetch_template_assets(
|
|
253
|
-
self, template_id: str, tenant_uuid: str
|
|
254
|
-
) -> list[DBDocumentTemplateAsset]:
|
|
249
|
+
self, template_id: str, tenant_uuid: str,
|
|
250
|
+
) -> list[model.DBDocumentTemplateAsset]:
|
|
255
251
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
256
252
|
cursor.execute(
|
|
257
253
|
query=self.SELECT_TEMPLATE_ASSETS,
|
|
258
254
|
params=(template_id, tenant_uuid),
|
|
259
255
|
)
|
|
260
|
-
return [DBDocumentTemplateAsset.from_dict_row(x) for x in cursor.fetchall()]
|
|
256
|
+
return [model.DBDocumentTemplateAsset.from_dict_row(x) for x in cursor.fetchall()]
|
|
261
257
|
|
|
262
258
|
@tenacity.retry(
|
|
263
259
|
reraise=True,
|
|
@@ -266,13 +262,14 @@ class Database:
|
|
|
266
262
|
before=tenacity.before_log(LOG, logging.DEBUG),
|
|
267
263
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
268
264
|
)
|
|
269
|
-
def fetch_project_documents(self, project_uuid: str,
|
|
265
|
+
def fetch_project_documents(self, project_uuid: str,
|
|
266
|
+
tenant_uuid: str) -> list[model.DBDocument]:
|
|
270
267
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
271
268
|
cursor.execute(
|
|
272
269
|
query=self.SELECT_DOCUMENTS,
|
|
273
270
|
params=(project_uuid, tenant_uuid),
|
|
274
271
|
)
|
|
275
|
-
return [DBDocument.from_dict_row(x) for x in cursor.fetchall()]
|
|
272
|
+
return [model.DBDocument.from_dict_row(x) for x in cursor.fetchall()]
|
|
276
273
|
|
|
277
274
|
@tenacity.retry(
|
|
278
275
|
reraise=True,
|
|
@@ -282,13 +279,13 @@ class Database:
|
|
|
282
279
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
283
280
|
)
|
|
284
281
|
def fetch_document_submissions(self, document_uuid: str,
|
|
285
|
-
tenant_uuid: str) -> list[DBSubmission]:
|
|
282
|
+
tenant_uuid: str) -> list[model.DBSubmission]:
|
|
286
283
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
287
284
|
cursor.execute(
|
|
288
285
|
query=self.SELECT_DOCUMENT_SUBMISSIONS,
|
|
289
286
|
params=(document_uuid, tenant_uuid),
|
|
290
287
|
)
|
|
291
|
-
return [DBSubmission.from_dict_row(x) for x in cursor.fetchall()]
|
|
288
|
+
return [model.DBSubmission.from_dict_row(x) for x in cursor.fetchall()]
|
|
292
289
|
|
|
293
290
|
@tenacity.retry(
|
|
294
291
|
reraise=True,
|
|
@@ -298,13 +295,13 @@ class Database:
|
|
|
298
295
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
299
296
|
)
|
|
300
297
|
def fetch_project_submissions(self, project_uuid: str,
|
|
301
|
-
tenant_uuid: str) -> list[DBSubmission]:
|
|
298
|
+
tenant_uuid: str) -> list[model.DBSubmission]:
|
|
302
299
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
303
300
|
cursor.execute(
|
|
304
301
|
query=self.SELECT_PROJECT_SUBMISSIONS,
|
|
305
302
|
params=(project_uuid, tenant_uuid),
|
|
306
303
|
)
|
|
307
|
-
return [DBSubmission.from_dict_row(x) for x in cursor.fetchall()]
|
|
304
|
+
return [model.DBSubmission.from_dict_row(x) for x in cursor.fetchall()]
|
|
308
305
|
|
|
309
306
|
@tenacity.retry(
|
|
310
307
|
reraise=True,
|
|
@@ -314,13 +311,13 @@ class Database:
|
|
|
314
311
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
315
312
|
)
|
|
316
313
|
def fetch_project_simple(self, project_uuid: str,
|
|
317
|
-
tenant_uuid: str) -> DBProjectSimple:
|
|
314
|
+
tenant_uuid: str) -> model.DBProjectSimple:
|
|
318
315
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
319
316
|
cursor.execute(
|
|
320
317
|
query=self.SELECT_PROJECT_SIMPLE,
|
|
321
318
|
params=(project_uuid, tenant_uuid),
|
|
322
319
|
)
|
|
323
|
-
return DBProjectSimple.from_dict_row(cursor.fetchone())
|
|
320
|
+
return model.DBProjectSimple.from_dict_row(cursor.fetchone())
|
|
324
321
|
|
|
325
322
|
@tenacity.retry(
|
|
326
323
|
reraise=True,
|
|
@@ -351,7 +348,7 @@ class Database:
|
|
|
351
348
|
query=self.UPDATE_DOCUMENT_RETRIEVED,
|
|
352
349
|
params=(
|
|
353
350
|
retrieved_at,
|
|
354
|
-
DocumentState.PROCESSING.value,
|
|
351
|
+
model.DocumentState.PROCESSING.value,
|
|
355
352
|
document_uuid,
|
|
356
353
|
),
|
|
357
354
|
)
|
|
@@ -366,14 +363,14 @@ class Database:
|
|
|
366
363
|
)
|
|
367
364
|
def update_document_finished(
|
|
368
365
|
self, *, finished_at: datetime.datetime, file_name: str, file_size: int,
|
|
369
|
-
content_type: str,
|
|
366
|
+
content_type: str, worker_log: str, document_uuid: str,
|
|
370
367
|
) -> bool:
|
|
371
368
|
with self.conn_query.new_cursor() as cursor:
|
|
372
369
|
cursor.execute(
|
|
373
370
|
query=self.UPDATE_DOCUMENT_FINISHED,
|
|
374
371
|
params=(
|
|
375
372
|
finished_at,
|
|
376
|
-
DocumentState.FINISHED.value,
|
|
373
|
+
model.DocumentState.FINISHED.value,
|
|
377
374
|
file_name,
|
|
378
375
|
content_type,
|
|
379
376
|
worker_log,
|
|
@@ -406,7 +403,7 @@ class Database:
|
|
|
406
403
|
before=tenacity.before_log(LOG, logging.DEBUG),
|
|
407
404
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
408
405
|
)
|
|
409
|
-
def get_mail_config(self, mail_config_uuid: str) -> DBInstanceConfigMail | None:
|
|
406
|
+
def get_mail_config(self, mail_config_uuid: str) -> model.DBInstanceConfigMail | None:
|
|
410
407
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
411
408
|
if not self._check_table_exists(table_name='instance_config_mail'):
|
|
412
409
|
return None
|
|
@@ -418,7 +415,7 @@ class Database:
|
|
|
418
415
|
result = cursor.fetchone()
|
|
419
416
|
if result is None:
|
|
420
417
|
return None
|
|
421
|
-
return DBInstanceConfigMail.from_dict_row(data=result)
|
|
418
|
+
return model.DBInstanceConfigMail.from_dict_row(data=result)
|
|
422
419
|
except Exception as e:
|
|
423
420
|
LOG.warning('Could not retrieve instance_config_mail "%s": %s',
|
|
424
421
|
mail_config_uuid, str(e))
|
|
@@ -431,7 +428,7 @@ class Database:
|
|
|
431
428
|
before=tenacity.before_log(LOG, logging.DEBUG),
|
|
432
429
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
433
430
|
)
|
|
434
|
-
def get_user(self, user_uuid: str, tenant_uuid: str) -> DBUserEntity | None:
|
|
431
|
+
def get_user(self, user_uuid: str, tenant_uuid: str) -> model.DBUserEntity | None:
|
|
435
432
|
if not self._check_table_exists(table_name='user_entity'):
|
|
436
433
|
return None
|
|
437
434
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
@@ -443,7 +440,7 @@ class Database:
|
|
|
443
440
|
result = cursor.fetchone()
|
|
444
441
|
if result is None:
|
|
445
442
|
return None
|
|
446
|
-
return DBUserEntity.from_dict_row(data=result)
|
|
443
|
+
return model.DBUserEntity.from_dict_row(data=result)
|
|
447
444
|
except Exception as e:
|
|
448
445
|
LOG.warning('Could not retrieve user "%s" for tenant "%s": %s',
|
|
449
446
|
user_uuid, tenant_uuid, str(e))
|
|
@@ -456,7 +453,7 @@ class Database:
|
|
|
456
453
|
before=tenacity.before_log(LOG, logging.DEBUG),
|
|
457
454
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
458
455
|
)
|
|
459
|
-
def get_default_locale(self, tenant_uuid: str) -> DBLocale | None:
|
|
456
|
+
def get_default_locale(self, tenant_uuid: str) -> model.DBLocale | None:
|
|
460
457
|
if not self._check_table_exists(table_name='locale'):
|
|
461
458
|
return None
|
|
462
459
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
@@ -468,7 +465,7 @@ class Database:
|
|
|
468
465
|
result = cursor.fetchone()
|
|
469
466
|
if result is None:
|
|
470
467
|
return None
|
|
471
|
-
return DBLocale.from_dict_row(data=result)
|
|
468
|
+
return model.DBLocale.from_dict_row(data=result)
|
|
472
469
|
except Exception as e:
|
|
473
470
|
LOG.warning('Could not retrieve default locale for tenant "%s": %s',
|
|
474
471
|
tenant_uuid, str(e))
|
|
@@ -481,22 +478,22 @@ class Database:
|
|
|
481
478
|
before=tenacity.before_log(LOG, logging.DEBUG),
|
|
482
479
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
483
480
|
)
|
|
484
|
-
def get_locale(self,
|
|
481
|
+
def get_locale(self, locale_uuid: str, tenant_uuid: str) -> model.DBLocale | None:
|
|
485
482
|
if not self._check_table_exists(table_name='locale'):
|
|
486
483
|
return None
|
|
487
484
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
488
485
|
try:
|
|
489
486
|
cursor.execute(
|
|
490
487
|
query=self.SELECT_LOCALE,
|
|
491
|
-
params={'
|
|
488
|
+
params={'locale_uuid': locale_uuid, 'tenant_uuid': tenant_uuid},
|
|
492
489
|
)
|
|
493
490
|
result = cursor.fetchone()
|
|
494
491
|
if result is None:
|
|
495
492
|
return None
|
|
496
|
-
return DBLocale.from_dict_row(data=result)
|
|
493
|
+
return model.DBLocale.from_dict_row(data=result)
|
|
497
494
|
except Exception as e:
|
|
498
495
|
LOG.warning('Could not retrieve locale "%s" for tenant "%s": %s',
|
|
499
|
-
|
|
496
|
+
locale_uuid, tenant_uuid, str(e))
|
|
500
497
|
return None
|
|
501
498
|
|
|
502
499
|
@tenacity.retry(
|
|
@@ -533,7 +530,7 @@ class Database:
|
|
|
533
530
|
before=tenacity.before_log(LOG, logging.DEBUG),
|
|
534
531
|
after=tenacity.after_log(LOG, logging.DEBUG),
|
|
535
532
|
)
|
|
536
|
-
def get_component_info(self, name: str) -> DBComponent | None:
|
|
533
|
+
def get_component_info(self, name: str) -> model.DBComponent | None:
|
|
537
534
|
if not self._check_table_exists(table_name='component'):
|
|
538
535
|
return None
|
|
539
536
|
with self.conn_query.new_cursor(use_dict=True) as cursor:
|
|
@@ -545,7 +542,7 @@ class Database:
|
|
|
545
542
|
result = cursor.fetchone()
|
|
546
543
|
if result is None:
|
|
547
544
|
return None
|
|
548
|
-
return DBComponent.from_dict_row(data=result)
|
|
545
|
+
return model.DBComponent.from_dict_row(data=result)
|
|
549
546
|
except Exception as e:
|
|
550
547
|
LOG.warning('Could not get component info: %s', str(e))
|
|
551
548
|
return None
|
|
@@ -408,7 +408,10 @@ class DBUserEntity:
|
|
|
408
408
|
class DBLocale:
|
|
409
409
|
TABLE_NAME = 'locale'
|
|
410
410
|
|
|
411
|
-
|
|
411
|
+
uuid: str
|
|
412
|
+
organization_id: str
|
|
413
|
+
locale_id: str
|
|
414
|
+
version: str
|
|
412
415
|
name: str
|
|
413
416
|
code: str
|
|
414
417
|
default_locale: bool
|
|
@@ -417,13 +420,20 @@ class DBLocale:
|
|
|
417
420
|
@staticmethod
|
|
418
421
|
def from_dict_row(data: dict):
|
|
419
422
|
return DBLocale(
|
|
420
|
-
|
|
423
|
+
uuid=str(data['uuid']),
|
|
424
|
+
organization_id=data['organization_id'],
|
|
425
|
+
locale_id=data['locale_id'],
|
|
426
|
+
version=data['version'],
|
|
421
427
|
name=data['name'],
|
|
422
428
|
code=data['code'],
|
|
423
429
|
default_locale=data['default_locale'],
|
|
424
430
|
enabled=data['enabled'],
|
|
425
431
|
)
|
|
426
432
|
|
|
433
|
+
@property
|
|
434
|
+
def id(self) -> str:
|
|
435
|
+
return f'{self.organization_id}:{self.locale_id}:{self.version}'
|
|
436
|
+
|
|
427
437
|
|
|
428
438
|
@dataclasses.dataclass
|
|
429
439
|
class DBInstanceConfigMail:
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "dsw-database"
|
|
3
|
+
version = "4.27.0"
|
|
4
|
+
description = "Library for managing DSW database"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
keywords = ["dsw", "database"]
|
|
7
|
+
license = { text = "Apache License 2.0" }
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Marek Suchánek", email = "marek.suchanek@ds-wizard.org" }
|
|
10
|
+
]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 5 - Production/Stable",
|
|
13
|
+
"License :: OSI Approved :: Apache Software License",
|
|
14
|
+
"Programming Language :: Python",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Topic :: Database",
|
|
18
|
+
"Topic :: Utilities",
|
|
19
|
+
]
|
|
20
|
+
requires-python = ">=3.12, <4"
|
|
21
|
+
dependencies = [
|
|
22
|
+
"psycopg[binary]",
|
|
23
|
+
"tenacity",
|
|
24
|
+
# DSW
|
|
25
|
+
"dsw-config==4.27.0",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://ds-wizard.org"
|
|
30
|
+
Repository = "https://github.com/ds-wizard/engine-tools"
|
|
31
|
+
Documentation = "https://guide.ds-wizard.org"
|
|
32
|
+
Issues = "https://github.com/ds-wizard/ds-wizard/issues"
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["uv_build>=0.9.25,<0.10.0"]
|
|
36
|
+
build-backend = "uv_build"
|
|
37
|
+
|
|
38
|
+
[tool.uv.build-backend]
|
|
39
|
+
module-name = "dsw.database"
|
|
40
|
+
module-root = ""
|
dsw_database-4.26.0rc1/LICENSE
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Apache License
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
5
|
-
|
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
-
|
|
8
|
-
1. Definitions.
|
|
9
|
-
|
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
-
the copyright owner that is granting the License.
|
|
15
|
-
|
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
-
|
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
-
exercising permissions granted by this License.
|
|
26
|
-
|
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
30
|
-
|
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
|
32
|
-
transformation or translation of a Source form, including but
|
|
33
|
-
not limited to compiled object code, generated documentation,
|
|
34
|
-
and conversions to other media types.
|
|
35
|
-
|
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
40
|
-
|
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
48
|
-
|
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
-
subsequently incorporated within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding those notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
-
|
|
181
|
-
To apply the Apache License to your work, attach the following
|
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
-
replaced with your own identifying information. (Don't include
|
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
-
comment syntax for the file format. We also recommend that a
|
|
186
|
-
file or class name and description of purpose be included on the
|
|
187
|
-
same "printed page" as the copyright notice for easier
|
|
188
|
-
identification within third-party archives.
|
|
189
|
-
|
|
190
|
-
Copyright 2020 Marek Suchánek
|
|
191
|
-
|
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
-
you may not use this file except in compliance with the License.
|
|
194
|
-
You may obtain a copy of the License at
|
|
195
|
-
|
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
-
|
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
-
See the License for the specific language governing permissions and
|
|
202
|
-
limitations under the License.
|
dsw_database-4.26.0rc1/PKG-INFO
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: dsw-database
|
|
3
|
-
Version: 4.26.0rc1
|
|
4
|
-
Summary: Library for managing DSW database
|
|
5
|
-
Author-email: Marek Suchánek <marek.suchanek@ds-wizard.org>
|
|
6
|
-
License: Apache License 2.0
|
|
7
|
-
Project-URL: Homepage, https://ds-wizard.org
|
|
8
|
-
Project-URL: Repository, https://github.com/ds-wizard/engine-tools
|
|
9
|
-
Project-URL: Documentation, https://guide.ds-wizard.org
|
|
10
|
-
Keywords: dsw,database
|
|
11
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
-
Classifier: Topic :: Database
|
|
17
|
-
Classifier: Topic :: Utilities
|
|
18
|
-
Requires-Python: <4,>=3.12
|
|
19
|
-
Description-Content-Type: text/markdown
|
|
20
|
-
License-File: LICENSE
|
|
21
|
-
Requires-Dist: psycopg[binary]
|
|
22
|
-
Requires-Dist: tenacity
|
|
23
|
-
Requires-Dist: dsw-config==4.26.0rc1
|
|
24
|
-
Dynamic: license-file
|
|
25
|
-
|
|
26
|
-
# Data Stewardship Wizard: Database
|
|
27
|
-
|
|
28
|
-
[](https://github.com/ds-wizard/engine-tools/releases)
|
|
29
|
-
[](https://pypi.org/project/dsw-database/)
|
|
30
|
-
[](LICENSE)
|
|
31
|
-
[](https://bestpractices.coreinfrastructure.org/projects/4975)
|
|
32
|
-
[](https://python.org)
|
|
33
|
-
|
|
34
|
-
*Library for working with DSW database*
|
|
35
|
-
|
|
36
|
-
## Usage
|
|
37
|
-
|
|
38
|
-
Currently, this library is intended for internal use of DSW tooling only.
|
|
39
|
-
Enhancements for use in custom scripts are planned for future development.
|
|
40
|
-
|
|
41
|
-
## License
|
|
42
|
-
|
|
43
|
-
This project is licensed under the Apache License v2.0 - see the
|
|
44
|
-
[LICENSE](LICENSE) file for more details.
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
pyproject.toml
|
|
4
|
-
setup.py
|
|
5
|
-
dsw/database/__init__.py
|
|
6
|
-
dsw/database/build_info.py
|
|
7
|
-
dsw/database/database.py
|
|
8
|
-
dsw/database/model.py
|
|
9
|
-
dsw_database.egg-info/PKG-INFO
|
|
10
|
-
dsw_database.egg-info/SOURCES.txt
|
|
11
|
-
dsw_database.egg-info/dependency_links.txt
|
|
12
|
-
dsw_database.egg-info/not-zip-safe
|
|
13
|
-
dsw_database.egg-info/requires.txt
|
|
14
|
-
dsw_database.egg-info/top_level.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
dsw
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ['setuptools']
|
|
3
|
-
build-backend = 'setuptools.build_meta'
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = 'dsw-database'
|
|
7
|
-
version = "4.26.0rc1"
|
|
8
|
-
description = 'Library for managing DSW database'
|
|
9
|
-
readme = 'README.md'
|
|
10
|
-
keywords = ['dsw', 'database']
|
|
11
|
-
license = { text = 'Apache License 2.0' }
|
|
12
|
-
authors = [
|
|
13
|
-
{ name = 'Marek Suchánek', email = 'marek.suchanek@ds-wizard.org' }
|
|
14
|
-
]
|
|
15
|
-
classifiers = [
|
|
16
|
-
'Development Status :: 5 - Production/Stable',
|
|
17
|
-
'License :: OSI Approved :: Apache Software License',
|
|
18
|
-
'Programming Language :: Python',
|
|
19
|
-
'Programming Language :: Python :: 3.12',
|
|
20
|
-
'Programming Language :: Python :: 3.13',
|
|
21
|
-
'Topic :: Database',
|
|
22
|
-
'Topic :: Utilities',
|
|
23
|
-
]
|
|
24
|
-
requires-python = '>=3.12, <4'
|
|
25
|
-
dependencies = [
|
|
26
|
-
'psycopg[binary]',
|
|
27
|
-
'tenacity',
|
|
28
|
-
# DSW
|
|
29
|
-
"dsw-config==4.26.0rc1",
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
[project.urls]
|
|
33
|
-
Homepage = 'https://ds-wizard.org'
|
|
34
|
-
Repository = 'https://github.com/ds-wizard/engine-tools'
|
|
35
|
-
Documentation = 'https://guide.ds-wizard.org'
|
|
36
|
-
|
|
37
|
-
[tool.setuptools]
|
|
38
|
-
zip-safe = false
|
|
39
|
-
|
|
40
|
-
[tool.setuptools.packages.find]
|
|
41
|
-
include = ['dsw*']
|
|
42
|
-
|
|
43
|
-
[tool.distutils.bdist_wheel]
|
|
44
|
-
universal = true
|
dsw_database-4.26.0rc1/setup.cfg
DELETED
dsw_database-4.26.0rc1/setup.py
DELETED
|
File without changes
|