diff --git a/pyproject.toml b/pyproject.toml index 1759792..8a46654 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,6 @@ +[project] +name = "dwclib" + [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" @@ -14,10 +17,10 @@ repository = "https://github.com/larib-data/dwclib" [tool.poetry.dependencies] python = ">=3.8,<4" numpy = "^1" -pandas = ">=1.4,<3" +pandas = ">=2.2.0" dask = ">=2023" -SQLAlchemy = "~1.4" -platformdirs = "^3.0.0" +SQLAlchemy = ">=2.0.25" +platformdirs = ">=4.2.0" [tool.poetry.dev-dependencies] flake8 = "^4.0.1" diff --git a/src/dwclib/alerts/alerts.py b/src/dwclib/alerts/alerts.py index d19807e..0363e5f 100644 --- a/src/dwclib/alerts/alerts.py +++ b/src/dwclib/alerts/alerts.py @@ -45,8 +45,8 @@ def run_alerts_query( def build_alerts_query(engine, dtbegin, dtend, patientids): - dbmeta = MetaData(bind=engine) - at = Table('Alert_', dbmeta, schema='_Export', autoload=True, autoload_with=engine) + dbmeta = MetaData() + at = Table('Alert_', dbmeta, schema='_Export', autoload_with=engine) aq = select( at.c.AlertId, diff --git a/src/dwclib/common/numerics.py b/src/dwclib/common/numerics.py index f3160c7..e62dec3 100644 --- a/src/dwclib/common/numerics.py +++ b/src/dwclib/common/numerics.py @@ -30,12 +30,12 @@ def run_numerics_query( def build_numerics_query(engine, dtbegin, dtend, patientids, labels, sublabels): - dbmeta = MetaData(bind=engine) + dbmeta = MetaData() nnt = Table( - 'Numeric_', dbmeta, schema='_Export', autoload=True, autoload_with=engine + 'Numeric_', dbmeta, schema='_Export', autoload_with=engine ) nvt = Table( - 'NumericValue_', dbmeta, schema='_Export', autoload=True, autoload_with=engine + 'NumericValue_', dbmeta, schema='_Export', autoload_with=engine ) nn = select(nnt.c.TimeStamp, nnt.c.Id, nnt.c.Label, nnt.c.SubLabel) diff --git a/src/dwclib/common/waves.py b/src/dwclib/common/waves.py index 4413f4e..c1d3b85 100644 --- a/src/dwclib/common/waves.py +++ b/src/dwclib/common/waves.py @@ -19,10 +19,10 @@ def run_waves_query(uri, dtbegin, dtend, patientid, labels): def build_waves_query(engine, dtbegin, dtend, patientid, labels): - dbmeta = MetaData(bind=engine) - wwt = Table('Wave_', dbmeta, schema='_Export', autoload=True, autoload_with=engine) + dbmeta = MetaData() + wwt = Table('Wave_', dbmeta, schema='_Export', autoload_with=engine) wst = Table( - 'WaveSample_', dbmeta, schema='_Export', autoload=True, autoload_with=engine + 'WaveSample_', dbmeta, schema='_Export', autoload_with=engine ) ww = select( diff --git a/src/dwclib/enumerations/enumerations.py b/src/dwclib/enumerations/enumerations.py index 883a53e..71aa482 100644 --- a/src/dwclib/enumerations/enumerations.py +++ b/src/dwclib/enumerations/enumerations.py @@ -66,9 +66,9 @@ def run_enumerations_query( def build_enumerations_query(engine, dtbegin, dtend, patientids, labels): - dbmeta = MetaData(bind=engine) - eet = Table('Enumeration_', dbmeta, schema='_Export', autoload=True, autoload_with=engine) - evt = Table('EnumerationValue_', dbmeta, schema='_Export', autoload=True, autoload_with=engine) + dbmeta = MetaData() + eet = Table('Enumeration_', dbmeta, schema='_Export', autoload_with=engine) + evt = Table('EnumerationValue_', dbmeta, schema='_Export', autoload_with=engine) ee = select(eet.c.TimeStamp, eet.c.Id, eet.c.Label) ee = ee.with_hint(eet, 'WITH (NOLOCK)') diff --git a/src/dwclib/patients/patients.py b/src/dwclib/patients/patients.py index d384e9b..aebacea 100644 --- a/src/dwclib/patients/patients.py +++ b/src/dwclib/patients/patients.py @@ -113,7 +113,7 @@ def build_query( numericsublabels, ): pgdb = create_engine(uri) - pgmeta = MetaData(bind=pgdb) + pgmeta = MetaData() t_patients = Table('patients', pgmeta, autoload_with=pgdb) p = t_patients.c @@ -136,7 +136,7 @@ def build_query( t_patients = select(fields).cte() # Replace Patients table with CTE p = t_patients.c - q = select([t_patients, pl.numericlabels, pl.numericsublabels, pl.wavelabels]) + q = select(t_patients, pl.numericlabels, pl.numericsublabels, pl.wavelabels) q = q.select_from(t_patients.join(t_patientlabels, pl.patientid == p.patientid, isouter=True)) if patientid: q = q.where(p.patientid == patientid)