Skip to content

Commit

Permalink
Fix bucketise function to work with newer sqlalchemy results
Browse files Browse the repository at this point in the history
  • Loading branch information
russss committed Sep 19, 2023
1 parent 6c2f083 commit 8d5c800
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from sqlalchemy import true, inspect
from sqlalchemy.orm.base import NO_VALUE
from sqlalchemy.sql.functions import func
from sqlalchemy.engine.row import Row
from sqlalchemy_continuum.utils import version_class, transaction_class

from typing import TypeAlias
Expand Down Expand Up @@ -85,7 +86,7 @@ def bucketise(vals, boundaries):
counts = OrderedDict.fromkeys(ranges, 0)

for val in vals:
if isinstance(val, tuple):
if isinstance(val, (tuple, Row)):
# As a convenience for fetching counts/single columns in sqla
val, *_ = val

Expand Down

0 comments on commit 8d5c800

Please sign in to comment.