Skip to content

Commit 12c4786

Browse files
committed
Fix bulk download path generation
1 parent 6f961b4 commit 12c4786

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

nmdc_server/crud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ def construct_zip_file_path(data_object: models.DataObject) -> str:
439439
# - We probably want to reference the workflow activity but that
440440
# involves a complicated query... need a way to join that information
441441
# in the original query (possibly in the sqlalchemy relationship)
442-
omics_processing = data_object.omics_processing
442+
omics_processing = data_object.omics_processings[0]
443443
biosamples = cast(Optional[list[models.Biosample]], omics_processing.biosample_inputs)
444444

445445
def safe_name(name: str) -> str:

nmdc_server/models.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,16 @@ class DataObject(Base):
824824
omics_processing_id = Column(String, ForeignKey("omics_processing.id"), nullable=True)
825825
omics_processing = relationship(OmicsProcessing)
826826

827+
# Note that we're telling mypy to ignore this weird typing.
828+
# We are declaring this as a list of OmicsProcessing (which it is),
829+
# but mypy expects a RelationshipValue. This might be avoidable in
830+
# SQLAlchemy 2.0 using Mapped[...]
831+
omics_processings: List[OmicsProcessing] = relationship(
832+
OmicsProcessing,
833+
secondary=omics_processing_output_association,
834+
back_populates="outputs",
835+
) # type: ignore
836+
827837
# Define a property that can be used to shortcut calculating counts.
828838
# Useful when downstream code can more efficiently determine download
829839
# counts for a batch of DataObjects and inject those counts.

0 commit comments

Comments
 (0)