From f54d3801c0fbf041db109e2ffd3a399b7cdc9565 Mon Sep 17 00:00:00 2001 From: Krishna Gopal Date: Wed, 15 Nov 2023 15:55:11 -0800 Subject: [PATCH] Add custom message to validation decorator (#1373) --- .../decorators/base_sqlglot_validation_decorator.py | 5 ++++- .../validation/validators/presto_optimizing_validator.py | 4 ---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/querybook/server/lib/query_analysis/validation/decorators/base_sqlglot_validation_decorator.py b/querybook/server/lib/query_analysis/validation/decorators/base_sqlglot_validation_decorator.py index f4faadcac..1d9264ec2 100644 --- a/querybook/server/lib/query_analysis/validation/decorators/base_sqlglot_validation_decorator.py +++ b/querybook/server/lib/query_analysis/validation/decorators/base_sqlglot_validation_decorator.py @@ -49,7 +49,10 @@ def _get_query_validation_result( end_index: int, suggestion: str = None, validation_result_object_type=QueryValidationResultObjectType.LINT, + message: str = None, ): + if message is None: + message = self.message start_line, start_ch = self._get_query_coordinate_by_index(query, start_index) end_line, end_ch = self._get_query_coordinate_by_index(query, end_index) @@ -57,7 +60,7 @@ def _get_query_validation_result( start_line, start_ch, self.severity, - self.message, + message, validation_result_object_type, end_line=end_line, end_ch=end_ch, diff --git a/querybook/server/lib/query_analysis/validation/validators/presto_optimizing_validator.py b/querybook/server/lib/query_analysis/validation/validators/presto_optimizing_validator.py index 70bf71e0c..4aa012da1 100644 --- a/querybook/server/lib/query_analysis/validation/validators/presto_optimizing_validator.py +++ b/querybook/server/lib/query_analysis/validation/validators/presto_optimizing_validator.py @@ -205,10 +205,6 @@ class PrestoOptimizingValidator(BaseQueryValidator): def languages(self): return ["presto", "trino"] - @property - def tokenizer(self) -> Tokenizer: - return Trino.Tokenizer() - def _get_explain_validator(self): return PrestoExplainValidator("")