diff --git a/lib/galaxy/model/__init__.py b/lib/galaxy/model/__init__.py index 59dd1941e54d..8256b327e419 100644 --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -206,7 +206,11 @@ _datatypes_registry = None -mapper_registry = registry() +OPTIONAL_STR_TO_STR_DICT = Optional[Dict[str, str]] + +mapper_registry = registry( + type_annotation_map={OPTIONAL_STR_TO_STR_DICT: JSONType}, +) # When constructing filters with in for a fixed set of ids, maximum # number of items to place in the IN statement. Different databases @@ -1404,7 +1408,7 @@ class Job(Base, JobLike, UsesCreateAndUpdateTime, Dictifiable, Serializable): params: Mapped[Optional[str]] = mapped_column(TrimmedString(255), index=True) handler: Mapped[Optional[str]] = mapped_column(TrimmedString(255), index=True) preferred_object_store_id: Mapped[Optional[str]] = mapped_column(String(255), nullable=True) - object_store_id_overrides: Mapped[Optional[bytes]] = mapped_column(JSONType) + object_store_id_overrides: Mapped[OPTIONAL_STR_TO_STR_DICT] = mapped_column(JSONType) user = relationship("User") galaxy_session = relationship("GalaxySession") diff --git a/lib/galaxy/model/store/discover.py b/lib/galaxy/model/store/discover.py index 5847a5280bd5..a9b16ad72a45 100644 --- a/lib/galaxy/model/store/discover.py +++ b/lib/galaxy/model/store/discover.py @@ -470,8 +470,10 @@ def override_object_store_id(self, output_name: Optional[str] = None) -> Optiona if not job: return None default_object_store_id = job.object_store_id - object_store_id_overrides = job.object_store_id_overrides or {} # type:ignore[var-annotated] - return object_store_id_overrides.get(output_name, default_object_store_id) # type:ignore[union-attr] + if not output_name: + return default_object_store_id + object_store_id_overrides: Dict[str, str] = job.object_store_id_overrides or {} + return object_store_id_overrides.get(output_name, default_object_store_id) @property @abc.abstractmethod