Skip to content

Port dbp to SQLAlchemy 1.4/2.0 #135

@jtniehof

Description

@jtniehof

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 a0bf5e6

Closure condition

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    technical-debtNot strictly a bug but suboptimal implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions