Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MatBarba committed Sep 16, 2024
1 parent e2ed552 commit 638862e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/python/tests/core/compare_core_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,22 @@

import logging

from ensembl.core.models import Base
from ensembl.utils.database import DBConnection
from ensembl.utils.argparse import ArgumentParser
from ensembl.utils.logging import init_logging_with_args
from sqlalchemy import select
from sqlalchemy.exc import NoResultFound, MultipleResultsFound, OperationalError, ProgrammingError
from sqlalchemy.orm import Session

from ensembl.core.models import Base


def check_tables(session: Session, only_table: str = "") -> None:
"""Load data from a core using the ORM to check for any discrepancies in the definitions.
Args:
session: SQLAlchemy session.
only_table: Only check this one table instead of all of the tables defined in the ORM.
"""
success = []
errors = []
for table_name, table in Base.metadata.tables.items():
Expand All @@ -45,7 +50,6 @@ def check_tables(session: Session, only_table: str = "") -> None:
success.append(table_name)
except (NoResultFound, MultipleResultsFound):
success.append(table_name)
pass
except (OperationalError, ProgrammingError) as err:
# Show the problematic query and continue
logging.warning(f"{table_name}: {err}")
Expand Down

0 comments on commit 638862e

Please sign in to comment.