Skip to content

Commit

Permalink
fix(ddm): Fix wrong query handling (#59509)
Browse files Browse the repository at this point in the history
  • Loading branch information
iambriccardo committed Nov 7, 2023
1 parent 1b2c788 commit 5f93df7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/sentry/sentry_metrics/querying/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def _parse_query(self) -> Optional[Sequence[Condition]]:
key:value (_ key:value)?
in which the only supported operator is AND until this logic is switched to the metrics layer.
"""
if self._query is None:
if not self._query:
return None

# TODO: implement parsing via the discover grammar.
Expand All @@ -172,16 +172,13 @@ def _parse_query(self) -> Optional[Sequence[Condition]]:
for key, value in matches:
filters.append(Condition(lhs=Column(name=key), op=Op.EQ, rhs=value))

if not self._query:
raise InvalidMetricsQueryError("Error while parsing the query.")

return filters

def _parse_group_bys(self) -> Optional[Sequence[Column]]:
"""
Parses the group bys by converting them into a list of snuba columns.
"""
if self._group_bys is None:
if not self._group_bys:
return None

return [Column(group_by) for group_by in self._group_bys]
Expand Down

0 comments on commit 5f93df7

Please sign in to comment.