Skip to content

Commit 5b97a8d

Browse files
authored
Merge pull request #1720 from microbiomedata/1134-sample-list-issue
Fix wrong sample list results from SQLAlchemy orm query
2 parents bf28f6d + c7c8442 commit 5b97a8d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nmdc_server/query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from typing import Any, Dict, Generic, Iterator, List, Optional, Tuple, TypeVar, Union
1111

1212
from pydantic import BaseModel, ConfigDict, Field, PositiveInt
13-
from sqlalchemy import ARRAY, Column, and_, cast, desc, func, inspect, or_
13+
from sqlalchemy import ARRAY, Column, and_, cast, func, inspect, or_
1414
from sqlalchemy.orm import Query, Session, aliased, selectinload, with_expression
1515
from sqlalchemy.orm.util import AliasedClass
1616
from sqlalchemy.sql.expression import ClauseElement, intersect, union
@@ -846,7 +846,7 @@ def execute(self, db: Session, prefetch_omics_processing_data: bool = False) ->
846846
biosample_query = (
847847
db.query(model)
848848
.join(subquery, model.id == subquery.c.id) # type: ignore
849-
.order_by(desc(self.table.model.multiomics)) # type: ignore
849+
.order_by(self.table.model.multiomics.desc(), self.table.model.id) # type: ignore
850850
)
851851

852852
if prefetch_omics_processing_data:

0 commit comments

Comments
 (0)