Skip to content

Commit 911d72c

Browse files
fix(models): prevent SQLAlchemy and_() deprecation warning (apache#37020)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 169d27c commit 911d72c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

superset/models/helpers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3214,10 +3214,12 @@ def get_sqla_query( # pylint: disable=too-many-arguments,too-many-locals,too-ma
32143214
)
32153215

32163216
if granularity:
3217-
qry = qry.where(and_(*(time_filters + where_clause_and)))
3218-
else:
3217+
if time_filters or where_clause_and:
3218+
qry = qry.where(and_(*(time_filters + where_clause_and)))
3219+
elif where_clause_and:
32193220
qry = qry.where(and_(*where_clause_and))
3220-
qry = qry.having(and_(*having_clause_and))
3221+
if having_clause_and:
3222+
qry = qry.having(and_(*having_clause_and))
32213223

32223224
self.make_orderby_compatible(select_exprs, orderby_exprs)
32233225

0 commit comments

Comments
 (0)