diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index b9a39445c696..4099f769f029 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -106,6 +106,7 @@ from sqlalchemy.orm import ( aliased, column_property, + DeclarativeBase, deferred, joinedload, Mapped, @@ -119,6 +120,7 @@ from sqlalchemy.orm.attributes import flag_modified from sqlalchemy.orm.collections import attribute_keyed_dict from sqlalchemy.sql import exists +from sqlalchemy.sql.expression import FromClause from typing_extensions import ( Literal, Protocol, @@ -224,23 +226,15 @@ if TYPE_CHECKING: - # Workaround for https://github.com/python/mypy/issues/14182 - from sqlalchemy.orm import DeclarativeMeta as _DeclarativeMeta - - class DeclarativeMeta(_DeclarativeMeta, type): - pass - from galaxy.datatypes.data import Data from galaxy.tools import DefaultToolState from galaxy.workflow.modules import WorkflowModule class _HasTable: - table: Table - __table__: Table + table: FromClause + __table__: FromClause else: - from sqlalchemy.orm import DeclarativeMeta - _HasTable = object @@ -252,7 +246,7 @@ def get_uuid(uuid: Optional[Union[UUID, str]] = None) -> UUID: return UUID(str(uuid)) -class Base(_HasTable, metaclass=DeclarativeMeta): +class Base(_HasTable, DeclarativeBase): __abstract__ = True metadata = MetaData(naming_convention=NAMING_CONVENTION) mapper_registry.metadata = metadata