mtbls-mhd-integration 0.0.4__py3-none-any.whl → 0.0.5__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.
mtbls2mhd/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "v0.0.4"
1
+ __version__ = "v0.0.5"
2
2
 
3
3
  import pathlib
4
4
  import sys
@@ -4,7 +4,7 @@ from functools import lru_cache
4
4
  from logging import getLogger
5
5
  from typing import Any, Dict, List
6
6
 
7
- import psycopg2
7
+ import psycopg
8
8
  from metabolights_utils.models.common import ErrorMessage
9
9
  from metabolights_utils.models.metabolights.model import (
10
10
  CurationRequest,
@@ -16,7 +16,7 @@ from metabolights_utils.models.metabolights.model import (
16
16
  UserStatus,
17
17
  )
18
18
  from metabolights_utils.provider.study_provider import AbstractDbMetadataCollector
19
- from psycopg2.extras import DictCursor
19
+ from psycopg.rows import dict_row
20
20
  from sqlalchemy import or_, select
21
21
  from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine
22
22
  from sqlalchemy.orm import sessionmaker
@@ -83,15 +83,16 @@ def create_postgresql_connection(mtbls2mhd_config: Mtbls2MhdConfiguration):
83
83
  Creates and returns a PostgreSQL connection.
84
84
  """
85
85
  try:
86
- connection = psycopg2.connect(
86
+ connection = psycopg.connect(
87
87
  dbname=mtbls2mhd_config.database_name,
88
88
  user=mtbls2mhd_config.database_user,
89
89
  password=mtbls2mhd_config.database_user_password,
90
90
  host=mtbls2mhd_config.database_host,
91
91
  port=mtbls2mhd_config.database_host_port,
92
+ row_factory=dict_row,
92
93
  )
93
94
  return connection
94
- except psycopg2.Error as e:
95
+ except psycopg.Error as e:
95
96
  logger.exception(e)
96
97
  raise e
97
98
 
@@ -171,7 +172,7 @@ class DbMetadataCollector(AbstractDbMetadataCollector):
171
172
  where_clause = " and ".join(_filter)
172
173
  _input = f"select acc from studies where {where_clause};"
173
174
  try:
174
- cursor = connection.cursor(cursor_factory=DictCursor)
175
+ cursor = connection.cursor()
175
176
  cursor.execute(_input)
176
177
  data = cursor.fetchall()
177
178
  return data
@@ -196,7 +197,7 @@ class DbMetadataCollector(AbstractDbMetadataCollector):
196
197
  def _get_study_from_db(self, study_id: str, connection):
197
198
  _input = "select * from studies where acc = %(study_id)s;"
198
199
  try:
199
- cursor = connection.cursor(cursor_factory=DictCursor)
200
+ cursor = connection.cursor()
200
201
  cursor.execute(_input, {"study_id": study_id})
201
202
  data = cursor.fetchone()
202
203
  return data
@@ -207,7 +208,7 @@ class DbMetadataCollector(AbstractDbMetadataCollector):
207
208
  def _get_study_revision_from_db(self, study_id: str, revision: int, connection):
208
209
  _input = "select * from study_revisions where accession_number = %(study_id)s and revision_number = %(revision)s;"
209
210
  try:
210
- cursor = connection.cursor(cursor_factory=DictCursor)
211
+ cursor = connection.cursor()
211
212
  cursor.execute(_input, {"study_id": study_id, "revision": revision})
212
213
  data = cursor.fetchone()
213
214
  return data
@@ -221,7 +222,7 @@ class DbMetadataCollector(AbstractDbMetadataCollector):
221
222
  _input = f"select {', '.join(submitter_fields)} from studies as s, study_user as su, \
222
223
  users as u where su.userid = u.id and su.studyid = s.id and s.acc = %(study_id)s;"
223
224
  try:
224
- cursor = connection.cursor(cursor_factory=DictCursor)
225
+ cursor = connection.cursor()
225
226
  cursor.execute(_input, {"study_id": study_id})
226
227
  data = cursor.fetchall()
227
228
  if data:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mtbls-mhd-integration
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: MetaboLights - MetabolomicsHub Integration
5
5
  Author-email: MetaboLights Team <metabolights-help@ebi.ac.uk>
6
6
  License-Expression: Apache-2.0
@@ -9,8 +9,8 @@ Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
10
  Requires-Dist: asyncpg>=0.30.0
11
11
  Requires-Dist: metabolights-utils>=1.4.16
12
- Requires-Dist: mhd-model>=0.1.38
13
- Requires-Dist: psycopg2-binary>=2.9.11
12
+ Requires-Dist: mhd-model>=0.1.39
13
+ Requires-Dist: psycopg[binary,pool]>=3.3.2
14
14
  Requires-Dist: pydantic>=2.12.4
15
15
  Requires-Dist: pydantic-settings>=2.10.1
16
16
  Requires-Dist: pyyaml>=6.0.3
@@ -1,4 +1,4 @@
1
- mtbls2mhd/__init__.py,sha256=0RQ_KvhA4PDOi6RAs0G3nZ29xmHs6Cg1-e0ZdmBfJXA,157
1
+ mtbls2mhd/__init__.py,sha256=3byMWcFYU6S6BKe-liUPRtmlSwQrjbuEljIatokiM3s,157
2
2
  mtbls2mhd/config.py,sha256=BjOqAyfDhp9byoFjJz70xh4HRR8pu1yrm_5jweqygSI,2310
3
3
  mtbls2mhd/convertor_factory.py,sha256=4loatqIRIvIhcaeIS0cSonJNYJu47o56ZllX6593ypk,1133
4
4
  mtbls2mhd/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -10,14 +10,14 @@ mtbls2mhd/v0_1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  mtbls2mhd/v0_1/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  mtbls2mhd/v0_1/legacy/builder.py,sha256=Kz4bHoGIUFTaj3nJaHs5OFG095sgbHmOxd5r-rlCeL0,85414
12
12
  mtbls2mhd/v0_1/legacy/convertor.py,sha256=gewPleS8FH3TS63dALqtIUuX26dAkIFo701UMlKiOE8,2607
13
- mtbls2mhd/v0_1/legacy/db_metadata_collector.py,sha256=J3ZqlAVsvGu7aM4XsjL7gQ3HMqethuwyna8Tym8TfI0,13267
13
+ mtbls2mhd/v0_1/legacy/db_metadata_collector.py,sha256=4OyA_KD2X2zr7AHn8pQZJ0Y2_bW5r2_2wgTtQ93LM6A,13193
14
14
  mtbls2mhd/v0_1/legacy/folder_metadata_collector.py,sha256=1lELGwTsr12nBGwTog_Z8qi9dLt4awma56vBYoI678k,7439
15
15
  mtbls2mhd/v0_1/legacy/mtbls_study_schema.py,sha256=gUTbRmI8GfHI5leLiw8dxsmWnV3NnWw5RPX_LQWRFRQ,3162
16
16
  mtbls2mhd/v0_1/ms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  mtbls2mhd/v0_1/ms/convertor.py,sha256=kLIUpxOrH6hcs2Y9Bq1D0Mdvypg40pLyEJpHtGj6H_g,89
18
- mtbls_mhd_integration-0.0.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
19
- mtbls_mhd_integration-0.0.4.dist-info/METADATA,sha256=oDRVRlVaGTSrh_z3CxiH8l6AqhRp-fhTLe3f6XB7k_k,678
20
- mtbls_mhd_integration-0.0.4.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
21
- mtbls_mhd_integration-0.0.4.dist-info/entry_points.txt,sha256=WQjM4flaYMyvHyv9zGKjCVk1i1_FGdNlhTmFVGgLgxs,61
22
- mtbls_mhd_integration-0.0.4.dist-info/top_level.txt,sha256=b7pI95n6HIQMFXDD0yL1NwldiDc-XdeWql4Iw-uYygQ,10
23
- mtbls_mhd_integration-0.0.4.dist-info/RECORD,,
18
+ mtbls_mhd_integration-0.0.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
19
+ mtbls_mhd_integration-0.0.5.dist-info/METADATA,sha256=2BQEjtVChMbUMm737D2dUGEWB2kJoh0oUvmM0Dl57Hs,682
20
+ mtbls_mhd_integration-0.0.5.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
21
+ mtbls_mhd_integration-0.0.5.dist-info/entry_points.txt,sha256=WQjM4flaYMyvHyv9zGKjCVk1i1_FGdNlhTmFVGgLgxs,61
22
+ mtbls_mhd_integration-0.0.5.dist-info/top_level.txt,sha256=b7pI95n6HIQMFXDD0yL1NwldiDc-XdeWql4Iw-uYygQ,10
23
+ mtbls_mhd_integration-0.0.5.dist-info/RECORD,,