# Path: clouddq/utils.py
# def assert_not_none_or_empty(value: typing.Any, error_msg: str) -> None:
#     """
# 
#     Args:
#       value: typing.Any:
#       error_msg: str:
# 
#     Returns:
# 
#     """
#     if not value:
#         raise ValueError(error_msg)


from enum import Enum
from enum import unique
from pprint import pformat
from string import Template
from clouddq.utils import assert_not_none_or_empty
import re
),
SELECT
    CURRENT_TIMESTAMP() AS execution_ts,
    '{{ rule_binding_id }}' AS rule_binding_id,
    '{{ rule_id }}' AS rule_id,
    (select distinct num_rows_validated from data) as num_rows_validated,
    FALSE AS simple_rule_row_is_valid,
    COUNT(*) as complex_rule_validation_errors_count,
    FROM
        zero_record
    LEFT JOIN
    (
      {{ custom_sql_statement }}
    ) custom_sql_statement_validation_errors
    ON
    zero_record.rule_binding_id = custom_sql_statement_validation_errors.rule_binding_id
"""


def check_for_invalid_sql(rule_type: RuleType, sql_string: str) -> None:
    if RE_FORBIDDEN_SQL.search(sql_string):
        raise ValueError(
            f"RuleType: {rule_type.name} contains "
            f"invalid characters.\n"
            f"Current value: {sql_string}"
        )


def to_sql_custom_sql_expr(params: dict) -> Template:
    custom_sql_expr = params.get("custom_sql_expr", "")

# Path: clouddq/utils.py
# def assert_not_none_or_empty(value: typing.Any, error_msg: str) -> None:
#     """
# 
#     Args:
#       value: typing.Any:
#       error_msg: str:
# 
#     Returns:
# 
#     """
#     if not value:
#         raise ValueError(error_msg)


# Path: clouddq/classes/rule_type.py
from enum import Enum
from enum import unique
from pprint import pformat
from string import Template
from clouddq.utils import assert_not_none_or_empty
import re

),
SELECT
    CURRENT_TIMESTAMP() AS execution_ts,
    '{{ rule_binding_id }}' AS rule_binding_id,
    '{{ rule_id }}' AS rule_id,
    (select distinct num_rows_validated from data) as num_rows_validated,
    FALSE AS simple_rule_row_is_valid,
    COUNT(*) as complex_rule_validation_errors_count,
    FROM
        zero_record
    LEFT JOIN
    (
      {{ custom_sql_statement }}
    ) custom_sql_statement_validation_errors
    ON
    zero_record.rule_binding_id = custom_sql_statement_validation_errors.rule_binding_id
"""


def check_for_invalid_sql(rule_type: RuleType, sql_string: str) -> None:
    if RE_FORBIDDEN_SQL.search(sql_string):
        raise ValueError(
            f"RuleType: {rule_type.name} contains "
            f"invalid characters.\n"
            f"Current value: {sql_string}"
        )


def to_sql_custom_sql_expr(params: dict) -> Template:
    custom_sql_expr = params.get("custom_sql_expr", "")

    assert_not_none_or_empty(