dsw-database 4.25.1__py2.py3-none-any.whl → 4.26.0__py2.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.
@@ -9,9 +9,9 @@ BuildInfo = namedtuple(
9
9
  )
10
10
 
11
11
  BUILD_INFO = BuildInfo(
12
- version='v4.25.1~31a01b8',
13
- built_at='2025-12-19 12:48:15Z',
14
- sha='31a01b81b38254d1f771f4b109b60550a1debfa2',
12
+ version='v4.26.0~6fb9cb8',
13
+ built_at='2026-01-06 12:20:06Z',
14
+ sha='6fb9cb8a23068c7f699e72b0d22ff975db2ead69',
15
15
  branch='HEAD',
16
- tag='v4.25.1',
16
+ tag='v4.26.0',
17
17
  )
dsw/database/database.py CHANGED
@@ -14,7 +14,7 @@ from dsw.config.model import DatabaseConfig
14
14
  from .model import DBDocumentTemplate, DBDocumentTemplateFile, \
15
15
  DBDocumentTemplateAsset, DBDocument, DBComponent, \
16
16
  DocumentState, DBTenantLimits, DBSubmission, \
17
- DBInstanceConfigMail, DBQuestionnaireSimple, \
17
+ DBInstanceConfigMail, DBProjectSimple, \
18
18
  DBUserEntity, DBLocale, DBDocumentTemplateFormat, \
19
19
  DBDocumentTemplateStep
20
20
 
@@ -36,15 +36,15 @@ class Database:
36
36
 
37
37
  SELECT_DOCUMENT = ('SELECT * FROM document '
38
38
  'WHERE uuid = %s AND tenant_uuid = %s LIMIT 1;')
39
- SELECT_QTN_DOCUMENTS = ('SELECT * FROM document '
40
- 'WHERE questionnaire_uuid = %s AND tenant_uuid = %s;')
39
+ SELECT_DOCUMENTS = ('SELECT * FROM document '
40
+ 'WHERE project_uuid = %s AND tenant_uuid = %s;')
41
41
  SELECT_DOCUMENT_SUBMISSIONS = ('SELECT * FROM submission '
42
42
  'WHERE document_uuid = %s AND tenant_uuid = %s;')
43
- SELECT_QTN_SUBMISSIONS = ('SELECT s.* '
44
- 'FROM document d JOIN submission s ON d.uuid = s.document_uuid '
45
- 'WHERE d.questionnaire_uuid = %s AND d.tenant_uuid = %s;')
46
- SELECT_QTN_SIMPLE = ('SELECT qtn.* FROM questionnaire qtn '
47
- 'WHERE qtn.uuid = %s AND qtn.tenant_uuid = %s;')
43
+ SELECT_PROJECT_SUBMISSIONS = ('SELECT s.* '
44
+ 'FROM document d JOIN submission s ON d.uuid = s.document_uuid '
45
+ 'WHERE d.project_uuid = %s AND d.tenant_uuid = %s;')
46
+ SELECT_PROJECT_SIMPLE = ('SELECT p.* FROM project p '
47
+ 'WHERE p.uuid = %s AND p.tenant_uuid = %s;')
48
48
  SELECT_TENANT_LIMIT = ('SELECT uuid, storage FROM tenant_limit_bundle '
49
49
  'WHERE uuid = %(tenant_uuid)s LIMIT 1;')
50
50
  UPDATE_DOCUMENT_STATE = 'UPDATE document SET state = %s, worker_log = %s WHERE uuid = %s;'
@@ -79,7 +79,7 @@ class Database:
79
79
  '+ (SELECT COALESCE(SUM(file_size)::bigint, 0) '
80
80
  'FROM document_template_asset WHERE tenant_uuid = %(tenant_uuid)s) '
81
81
  '+ (SELECT COALESCE(SUM(file_size)::bigint, 0) '
82
- 'FROM questionnaire_file WHERE tenant_uuid = %(tenant_uuid)s) '
82
+ 'FROM project_file WHERE tenant_uuid = %(tenant_uuid)s) '
83
83
  'AS result;')
84
84
  SELECT_USER = ('SELECT * FROM user_entity '
85
85
  'WHERE uuid = %(user_uuid)s AND tenant_uuid = %(tenant_uuid)s;')
@@ -205,14 +205,10 @@ class Database:
205
205
  query=self.SELECT_TEMPLATE_STEPS,
206
206
  params=(template_id, tenant_uuid),
207
207
  )
208
- print(f'Format results: {formats_result}')
209
- print(f'Formats: {formats}')
210
208
  steps_result = cursor.fetchall()
211
209
  steps = sorted([
212
210
  DBDocumentTemplateStep.from_dict_row(x) for x in steps_result
213
211
  ], key=lambda x: x.position)
214
- print(f'Steps results: {formats_result}')
215
- print(f'Steps: {steps}')
216
212
  steps_dict: dict[str, list[dict]] = {}
217
213
  for step in steps:
218
214
  if step.format_uuid not in steps_dict:
@@ -227,7 +223,6 @@ class Database:
227
223
  'name': format_obj.name,
228
224
  'steps': steps_dict.get(format_obj.uuid, []),
229
225
  })
230
- print(template.formats)
231
226
  return template
232
227
 
233
228
  @tenacity.retry(
@@ -271,12 +266,11 @@ class Database:
271
266
  before=tenacity.before_log(LOG, logging.DEBUG),
272
267
  after=tenacity.after_log(LOG, logging.DEBUG),
273
268
  )
274
- def fetch_qtn_documents(self, questionnaire_uuid: str,
275
- tenant_uuid: str) -> list[DBDocument]:
269
+ def fetch_project_documents(self, project_uuid: str, tenant_uuid: str) -> list[DBDocument]:
276
270
  with self.conn_query.new_cursor(use_dict=True) as cursor:
277
271
  cursor.execute(
278
- query=self.SELECT_QTN_DOCUMENTS,
279
- params=(questionnaire_uuid, tenant_uuid),
272
+ query=self.SELECT_DOCUMENTS,
273
+ params=(project_uuid, tenant_uuid),
280
274
  )
281
275
  return [DBDocument.from_dict_row(x) for x in cursor.fetchall()]
282
276
 
@@ -303,12 +297,12 @@ class Database:
303
297
  before=tenacity.before_log(LOG, logging.DEBUG),
304
298
  after=tenacity.after_log(LOG, logging.DEBUG),
305
299
  )
306
- def fetch_questionnaire_submissions(self, questionnaire_uuid: str,
307
- tenant_uuid: str) -> list[DBSubmission]:
300
+ def fetch_project_submissions(self, project_uuid: str,
301
+ tenant_uuid: str) -> list[DBSubmission]:
308
302
  with self.conn_query.new_cursor(use_dict=True) as cursor:
309
303
  cursor.execute(
310
- query=self.SELECT_QTN_SUBMISSIONS,
311
- params=(questionnaire_uuid, tenant_uuid),
304
+ query=self.SELECT_PROJECT_SUBMISSIONS,
305
+ params=(project_uuid, tenant_uuid),
312
306
  )
313
307
  return [DBSubmission.from_dict_row(x) for x in cursor.fetchall()]
314
308
 
@@ -319,14 +313,14 @@ class Database:
319
313
  before=tenacity.before_log(LOG, logging.DEBUG),
320
314
  after=tenacity.after_log(LOG, logging.DEBUG),
321
315
  )
322
- def fetch_questionnaire_simple(self, questionnaire_uuid: str,
323
- tenant_uuid: str) -> DBQuestionnaireSimple:
316
+ def fetch_project_simple(self, project_uuid: str,
317
+ tenant_uuid: str) -> DBProjectSimple:
324
318
  with self.conn_query.new_cursor(use_dict=True) as cursor:
325
319
  cursor.execute(
326
- query=self.SELECT_QTN_SIMPLE,
327
- params=(questionnaire_uuid, tenant_uuid),
320
+ query=self.SELECT_PROJECT_SIMPLE,
321
+ params=(project_uuid, tenant_uuid),
328
322
  )
329
- return DBQuestionnaireSimple.from_dict_row(cursor.fetchone())
323
+ return DBProjectSimple.from_dict_row(cursor.fetchone())
330
324
 
331
325
  @tenacity.retry(
332
326
  reraise=True,
dsw/database/model.py CHANGED
@@ -45,9 +45,9 @@ class DBDocument:
45
45
  name: str
46
46
  state: str
47
47
  durability: str
48
- questionnaire_uuid: str | None
49
- questionnaire_event_uuid: str | None
50
- questionnaire_replies_hash: str
48
+ project_uuid: str | None
49
+ project_event_uuid: str | None
50
+ project_replies_hash: str
51
51
  document_template_id: str
52
52
  format_uuid: str
53
53
  file_name: str
@@ -62,16 +62,16 @@ class DBDocument:
62
62
 
63
63
  @staticmethod
64
64
  def from_dict_row(data: dict):
65
- qtn_uuid = data['questionnaire_uuid']
66
- event_uuid = data['questionnaire_event_uuid']
65
+ project_uuid = data['project_uuid']
66
+ event_uuid = data['project_event_uuid']
67
67
  return DBDocument(
68
68
  uuid=str(data['uuid']),
69
69
  name=data['name'],
70
70
  state=data['state'],
71
71
  durability=data['durability'],
72
- questionnaire_uuid=str(qtn_uuid) if qtn_uuid else None,
73
- questionnaire_event_uuid=str(event_uuid) if event_uuid else None,
74
- questionnaire_replies_hash=data['questionnaire_replies_hash'],
72
+ project_uuid=str(project_uuid) if project_uuid else None,
73
+ project_event_uuid=str(event_uuid) if event_uuid else None,
74
+ project_replies_hash=data['project_replies_hash'],
75
75
  document_template_id=data['document_template_id'],
76
76
  format_uuid=str(data['format_uuid']),
77
77
  created_by=str(data['created_by']),
@@ -325,10 +325,10 @@ class DBSubmission:
325
325
 
326
326
 
327
327
  @dataclasses.dataclass
328
- class DBQuestionnaireSimple:
328
+ class DBProjectSimple:
329
329
  # without: events, answered_questions, unanswered_questions,
330
330
  # squashed, versions, selected_question_tag_uuids
331
- TABLE_NAME = 'questionnaire'
331
+ TABLE_NAME = 'project'
332
332
 
333
333
  uuid: str
334
334
  name: str
@@ -347,7 +347,7 @@ class DBQuestionnaireSimple:
347
347
 
348
348
  @staticmethod
349
349
  def from_dict_row(data: dict):
350
- return DBQuestionnaireSimple(
350
+ return DBProjectSimple(
351
351
  uuid=str(data['uuid']),
352
352
  name=data['name'],
353
353
  visibility=data['visibility'],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dsw-database
3
- Version: 4.25.1
3
+ Version: 4.26.0
4
4
  Summary: Library for managing DSW database
5
5
  Author-email: Marek Suchánek <marek.suchanek@ds-wizard.org>
6
6
  License: Apache License 2.0
@@ -20,7 +20,7 @@ Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
21
  Requires-Dist: psycopg[binary]
22
22
  Requires-Dist: tenacity
23
- Requires-Dist: dsw-config==4.25.1
23
+ Requires-Dist: dsw-config==4.26.0
24
24
  Dynamic: license-file
25
25
 
26
26
  # Data Stewardship Wizard: Database
@@ -0,0 +1,9 @@
1
+ dsw/database/__init__.py,sha256=58ZXZ8i4xzAvvjUdqt8lvdv28hD0yzY_xxI6n9deynw,55
2
+ dsw/database/build_info.py,sha256=p3lrVLUBRLrO68MdoD1aP83OJiH3VGII05wYI-hBRbU,381
3
+ dsw/database/database.py,sha256=Wy-DPFeTQQZlWImZS1XYUtGeJMccA9Yql7qkzn7A8uM,27116
4
+ dsw/database/model.py,sha256=hjtLfZ0UsetgJYGl2LsOhgSrVpIL_K0Squm8g4f_R5o,13612
5
+ dsw_database-4.26.0.dist-info/licenses/LICENSE,sha256=rDtJ4LdsXvf_euOpGD0Q86P78K4JyM5m4yfYz9wZ750,11346
6
+ dsw_database-4.26.0.dist-info/METADATA,sha256=I8e_8UIG9wcaBTaqDfBTEYrHLHnx_v6MIBU1tVAZKAA,1843
7
+ dsw_database-4.26.0.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
8
+ dsw_database-4.26.0.dist-info/top_level.txt,sha256=7SfbsHFoJ_vlAgG6C-xzETETwYO71dBrGnod8uMFnjw,4
9
+ dsw_database-4.26.0.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- dsw/database/__init__.py,sha256=58ZXZ8i4xzAvvjUdqt8lvdv28hD0yzY_xxI6n9deynw,55
2
- dsw/database/build_info.py,sha256=tGprxsqrINBtV_KjxMqofgwmw68_gYoV3GgBY3FUj4Y,381
3
- dsw/database/database.py,sha256=2hXcU-txscH6qtKz1CT_JHIChdH4G_PgSNcIA6s4Tv8,27457
4
- dsw/database/model.py,sha256=qe_7vCUyGQQpc1hTf_gh1B1fAj1CsbyKdEE7HT2UkhU,13672
5
- dsw_database-4.25.1.dist-info/licenses/LICENSE,sha256=rDtJ4LdsXvf_euOpGD0Q86P78K4JyM5m4yfYz9wZ750,11346
6
- dsw_database-4.25.1.dist-info/METADATA,sha256=cbx-Zf7KjxQ6KUNiCDKrnyYKlntt43lqsV2a3Rv9asE,1843
7
- dsw_database-4.25.1.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
8
- dsw_database-4.25.1.dist-info/top_level.txt,sha256=7SfbsHFoJ_vlAgG6C-xzETETwYO71dBrGnod8uMFnjw,4
9
- dsw_database-4.25.1.dist-info/RECORD,,