Skip to content

Commit

Permalink
[explore] fix IN filter on numeric field (#2908)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Jun 6, 2017
1 parent e0dd5d9 commit 65f25a1
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,22 +477,23 @@ def get_sqla_query( # sqla
if op == 'not in':
cond = ~cond
where_clause_and.append(cond)
if col_obj.is_num:
eq = utils.string_to_num(flt['val'])
if op == '==':
where_clause_and.append(col_obj.sqla_col == eq)
elif op == '!=':
where_clause_and.append(col_obj.sqla_col != eq)
elif op == '>':
where_clause_and.append(col_obj.sqla_col > eq)
elif op == '<':
where_clause_and.append(col_obj.sqla_col < eq)
elif op == '>=':
where_clause_and.append(col_obj.sqla_col >= eq)
elif op == '<=':
where_clause_and.append(col_obj.sqla_col <= eq)
elif op == 'LIKE':
where_clause_and.append(col_obj.sqla_col.like(eq))
else:
if col_obj.is_num:
eq = utils.string_to_num(flt['val'])
if op == '==':
where_clause_and.append(col_obj.sqla_col == eq)
elif op == '!=':
where_clause_and.append(col_obj.sqla_col != eq)
elif op == '>':
where_clause_and.append(col_obj.sqla_col > eq)
elif op == '<':
where_clause_and.append(col_obj.sqla_col < eq)
elif op == '>=':
where_clause_and.append(col_obj.sqla_col >= eq)
elif op == '<=':
where_clause_and.append(col_obj.sqla_col <= eq)
elif op == 'LIKE':
where_clause_and.append(col_obj.sqla_col.like(eq))
if extras:
where = extras.get('where')
if where:
Expand Down

0 comments on commit 65f25a1

Please sign in to comment.