spacepy / dbprocessing

Automated processing controller for heliophysics data
5 stars 4 forks source link

Port dbp to SQLAlchemy 1.4/2.0 #135

Open jtniehof opened 9 months ago

jtniehof commented 9 months ago

dbprocessing currently uses "old" pre-2.0 SQLAlchemy syntax. The new 2.0 syntax is available in 1.4 and the old syntax is removed in 2.0. We need to just move to 1.4/2.0 syntax and leave behind old compatibility.

Minimal example to reproduce issue:

Install sqlalchemy 2.0 and

python3 setup.py build
cd unit_tests
python3 test_all.py

Error message/Traceback:

[a bunch of stuff]
======================================================================
ERROR: test_unique (test_Utils.UtilsTests)
unique
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jtniehof/scm/dbprocessing/unit_tests/test_Utils.py", line 30, in setUp
    self.makeTestDB()
  File "/home/jtniehof/scm/dbprocessing/unit_tests/dbp_testing.py", line 221, in makeTestDB
    dbprocessing.DButils.create_tables(
  File "/home/jtniehof/scm/dbprocessing/build/lib/dbprocessing/DButils.py", line 3899, in create_tables
    metadata.create_all(checkfirst=True)
TypeError: MetaData.create_all() missing 1 required positional argument: 'bind'

----------------------------------------------------------------------
Ran 301 tests in 3.384s

FAILED (errors=246)

(although there are other problems that are not solved by just doing this)

OS, Python version, and dependency version information:

Linux-5.15.0-76-generic-x86_64-with-glibc2.35
sys.version_info(major=3, minor=10, micro=12, releaselevel='final', serial=0)
sqlalchemy=2.0.23

Version of dbprocessing

Current git main a0bf5e682fb917bb707b4f66787b0ecb860efce1

Closure condition

This issue should be closed when all unit and functional tests run against SQLAlchemy 2.0 and the CI is updated.