[elbe-devel] [PATCH 3/5] elbepack: db: fall back to old declarative_base import

Thomas Weißschuh thomas.weissschuh at linutronix.de
Wed Oct 2 12:09:46 CEST 2024


Version of sqlalchemy older than 1.4 have a different import path.
Support these versions to for Debian bullseye compatibility.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/db.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/elbepack/db.py b/elbepack/db.py
index c13875c3d9e56df3e356c8e725cbff8d6de79822..eb3a8c6dd123e13826ef009ad9ef531483632ce1 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -28,7 +28,11 @@ from sqlalchemy import (
     create_engine,
 )
 from sqlalchemy.exc import OperationalError
-from sqlalchemy.orm import declarative_base, relationship, scoped_session, sessionmaker
+try:
+    from sqlalchemy.orm import declarative_base
+except ImportError:
+    from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.orm import relationship, scoped_session, sessionmaker
 from sqlalchemy.orm.exc import NoResultFound
 
 from elbepack.elbeproject import ElbeProject

-- 
2.46.2



More information about the elbe-devel mailing list