Skip to content

Commit 5f93df7

Browse files
author
Riccardo Busetti
authored
fix(ddm): Fix wrong query handling (#59509)
1 parent 1b2c788 commit 5f93df7

File tree

1 file changed

+2
-5
lines changed
  • src/sentry/sentry_metrics/querying

1 file changed

+2
-5
lines changed

src/sentry/sentry_metrics/querying/api.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def _parse_query(self) -> Optional[Sequence[Condition]]:
163163
key:value (_ key:value)?
164164
in which the only supported operator is AND until this logic is switched to the metrics layer.
165165
"""
166-
if self._query is None:
166+
if not self._query:
167167
return None
168168

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

175-
if not self._query:
176-
raise InvalidMetricsQueryError("Error while parsing the query.")
177-
178175
return filters
179176

180177
def _parse_group_bys(self) -> Optional[Sequence[Column]]:
181178
"""
182179
Parses the group bys by converting them into a list of snuba columns.
183180
"""
184-
if self._group_bys is None:
181+
if not self._group_bys:
185182
return None
186183

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

0 commit comments

Comments
 (0)