Skip to content

Commit

Permalink
log the warning properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Kluev committed Jan 12, 2022
1 parent 17c51f5 commit 6629ab9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions snuba/query/processors/uniq_in_select_and_having.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import logging
from dataclasses import fields
from typing import List, Sequence
from typing import Any, Dict, List, Sequence, cast

from snuba.clickhouse.processors import QueryProcessor
from snuba.clickhouse.query import Query
Expand Down Expand Up @@ -84,9 +84,13 @@ def process_query(self, query: Query, request_settings: RequestSettings) -> None
if not all(matcher.found_expressions):
should_throw = get_config("throw_on_uniq_select_and_having", False)
error = MismatchedAggregationException(
f"Aggregation is in HAVING clause but not SELECT: {uniq_finder.found_functions}"
"Aggregation is in HAVING clause but not SELECT", query=str(query)
)
if should_throw:
raise error
else:
logging.warning(str(error))
logging.warning(
"Aggregation is in HAVING clause but not SELECT",
exc_info=True,
extra=cast(Dict[str, Any], error.to_dict()),
)

0 comments on commit 6629ab9

Please sign in to comment.