From 54c32d4929acf091f4a2a15b9ee06072188f7a3d Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 1 Jul 2024 00:49:24 -0400 Subject: [PATCH] Migrate to SQLA 2.0. --- lib/galaxy/model/__init__.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 65c00f33ae9c..ce45149fc083 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -1335,23 +1335,23 @@ def __init__(self, user, token=None): class ToolSource(Base, Dictifiable, RepresentById): __tablename__ = "tool_source" - id = Column(Integer, primary_key=True) - hash = Column(Unicode(255)) - source = Column(JSONType) + id: Mapped[int] = mapped_column(primary_key=True) + hash: Mapped[Optional[str]] = mapped_column(Unicode(255)) + source: Mapped[dict] = mapped_column(JSONType) class ToolRequest(Base, Dictifiable, RepresentById): __tablename__ = "tool_request" - id = Column(Integer, primary_key=True) - tool_source_id = Column(Integer, ForeignKey("tool_source.id"), index=True) - history_id = Column(Integer, ForeignKey("history.id"), index=True) - request = Column(JSONType) - state = Column(TrimmedString(32), index=True) - state_message = Column(JSONType, index=True) + id: Mapped[int] = mapped_column(primary_key=True) + tool_source_id: Mapped[int] = mapped_column(ForeignKey("tool_source.id"), index=True) + history_id: Mapped[Optional[int]] = mapped_column(ForeignKey("history.id"), index=True) + request: Mapped[dict] = mapped_column(JSONType) + state: Mapped[Optional[str]] = mapped_column(TrimmedString(32), index=True) + state_message: Mapped[Optional[str]] = mapped_column(JSONType, index=True) - tool_source = relationship("ToolSource") - history = relationship("History", back_populates="tool_requests") + tool_source: Mapped["ToolSource"] = relationship() + history: Mapped[Optional["History"]] = relationship(back_populates="tool_requests") class states(str, Enum): NEW = "new"