Skip to content

Commit

Permalink
Fix for sqlalchemy_schemadisplay >= 2
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Verga <mattia.verga@tiscali.it>
  • Loading branch information
mattiaverga committed Feb 24, 2024
1 parent b5fec16 commit cd9572f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 0 additions & 3 deletions devel/ci/Dockerfile-pip
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ RUN pip-3 install \
pymediawiki \
celery

# proposed fix for sqlalchemy 2.0 compatibility
RUN pip-3 install git+https://github.com/fschulze/sqlalchemy_schemadisplay.git@refs/pull/34/head

VOLUME ["/results"]
WORKDIR /bodhi
CMD ["bash"]
Expand Down
12 changes: 8 additions & 4 deletions docs/generate_db_schema
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
Generate an image of the database schema
"""
from packaging import version
from sqlalchemy import __version__ as sqlaver
from sqlalchemy import create_engine
from sqlalchemy_schemadisplay import create_schema_graph
try:
from sqlalchemy_schemadisplay import __version__ as sqlschemaver
except ImportError:
sqlschemaver = '1.0'

from bodhi.server import models, Session
from bodhi.server import models


def write_graph(filename):
if version.parse(sqlaver) >= version.parse('2.0.0'):
if version.parse(sqlschemaver) >= version.parse('2.0'):
graph = create_schema_graph(
session=Session,
engine=create_engine('sqlite:///:memory:'),
metadata=models.metadata,
show_datatypes=False,
show_indexes=False,
Expand Down

0 comments on commit cd9572f

Please sign in to comment.