Minor tweaks.
This commit is contained in:
parent
1c5fa29943
commit
94837e1b6f
1 changed files with 3 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import Any, Callable, Type, TypeVar, Generic, Optional, Protocol, runtime_checkable, cast
|
from typing import Any, Callable, Type, TypeVar, Generic, Optional, Protocol, runtime_checkable, cast
|
||||||
from sqlalchemy import and_, func, inspect, or_, text
|
from sqlalchemy import and_, func, inspect, or_, text
|
||||||
from sqlalchemy.engine import Engine, Connection
|
from sqlalchemy.engine import Engine, Connection
|
||||||
from sqlalchemy.orm import Load, Session, selectinload, with_polymorphic, Mapper, RelationshipProperty, ColumnProperty
|
from sqlalchemy.orm import Load, Session, with_polymorphic, Mapper, RelationshipProperty
|
||||||
from sqlalchemy.orm.attributes import InstrumentedAttribute
|
from sqlalchemy.orm.attributes import InstrumentedAttribute
|
||||||
|
|
||||||
from crudkit.core.base import Version
|
from crudkit.core.base import Version
|
||||||
|
|
@ -232,7 +232,7 @@ class CRUDService(Generic[T]):
|
||||||
total = None
|
total = None
|
||||||
if include_total:
|
if include_total:
|
||||||
base = self.session.query(getattr(root_alias, "id"))
|
base = self.session.query(getattr(root_alias, "id"))
|
||||||
if self.supports_soft_delete and not _is_truthy(params.get("include_deleted")):
|
if self.supports_soft_delete and not _is_truthy((params or {}).get("include_deleted")):
|
||||||
base = base.filter(getattr(root_alias, "is_deleted") == False)
|
base = base.filter(getattr(root_alias, "is_deleted") == False)
|
||||||
if filters:
|
if filters:
|
||||||
base = base.filter(*filters)
|
base = base.filter(*filters)
|
||||||
|
|
@ -279,7 +279,7 @@ class CRUDService(Generic[T]):
|
||||||
for col in mapper.primary_key:
|
for col in mapper.primary_key:
|
||||||
try:
|
try:
|
||||||
pk_cols.append(getattr(root_alias, col.key))
|
pk_cols.append(getattr(root_alias, col.key))
|
||||||
except ArithmeticError:
|
except AttributeError:
|
||||||
pk_cols.append(col)
|
pk_cols.append(col)
|
||||||
|
|
||||||
return [*order_by, *pk_cols]
|
return [*order_by, *pk_cols]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue