mayurnewase commented on a change in pull request #12482:
URL: https://github.com/apache/superset/pull/12482#discussion_r560803886



##########
File path: superset/connectors/sqla/utils.py
##########
@@ -0,0 +1,117 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from collections import OrderedDict  # pylint:disable = unused-import
+from typing import Any, Dict, List
+
+import pandas as pd
+import sqlalchemy as sa
+from flask_babel import lazy_gettext as _
+from jinja2.exceptions import TemplateError
+from sqlalchemy import and_, or_
+from sqlalchemy.sql import ColumnElement
+from sqlalchemy.sql.expression import BooleanClauseList, Label
+
+from superset.constants import NULL_STRING
+from superset.exceptions import QueryObjectValidationError
+from superset.jinja_context import BaseTemplateProcessor
+from superset.utils.core import cast_to_num, FilterOperator
+
+
+def get_having_clause(
+    extra_having: Any, template_processor: BaseTemplateProcessor
+) -> List[BooleanClauseList]:
+    """
+    generate complete having clause from extra arg 'have'
+    """
+    having_clause = []
+    if extra_having:
+        try:
+            having = template_processor.process_template(extra_having)
+        except TemplateError as ex:
+            raise QueryObjectValidationError(
+                _(
+                    "Error in jinja expression in HAVING clause: %(msg)s",
+                    msg=ex.message,
+                )
+            )
+        having_clause += [sa.text("({})".format(having))]
+    return having_clause
+
+
+def get_expected_labels_from_select(select_expressions: List[Label]) -> 
List[str]:
+    return [
+        c._df_label_expected  # pylint: disable=protected-access
+        for c in select_expressions
+    ]
+
+
+def get_where_operation(  # pylint:disable=too-many-branches
+    flt: Dict[str, Any], operation: str, col_obj: Any, value: Any

Review comment:
       updated

##########
File path: superset/connectors/sqla/utils.py
##########
@@ -0,0 +1,117 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from collections import OrderedDict  # pylint:disable = unused-import
+from typing import Any, Dict, List
+
+import pandas as pd
+import sqlalchemy as sa
+from flask_babel import lazy_gettext as _
+from jinja2.exceptions import TemplateError
+from sqlalchemy import and_, or_
+from sqlalchemy.sql import ColumnElement
+from sqlalchemy.sql.expression import BooleanClauseList, Label
+
+from superset.constants import NULL_STRING
+from superset.exceptions import QueryObjectValidationError
+from superset.jinja_context import BaseTemplateProcessor
+from superset.utils.core import cast_to_num, FilterOperator
+
+
+def get_having_clause(
+    extra_having: Any, template_processor: BaseTemplateProcessor

Review comment:
       updated




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to