diff --git a/airflow/providers/apache/hive/hooks/hive.py b/airflow/providers/apache/hive/hooks/hive.py index cd508b21866ce..c33c59dd5f6db 100644 --- a/airflow/providers/apache/hive/hooks/hive.py +++ b/airflow/providers/apache/hive/hooks/hive.py @@ -199,22 +199,26 @@ def _prepare_cli_cmd(self) -> list[Any]: def _validate_beeline_parameters(self, conn): if self.high_availability: if ";" in conn.schema: - raise Exception( + raise ValueError( f"The schema used in beeline command ({conn.schema}) should not contain ';' character)" ) return elif ":" in conn.host or "/" in conn.host or ";" in conn.host: - raise Exception( + raise ValueError( f"The host used in beeline command ({conn.host}) should not contain ':/;' characters)" ) try: int_port = int(conn.port) if not 0 < int_port <= 65535: - raise Exception(f"The port used in beeline command ({conn.port}) should be in range 0-65535)") + raise ValueError( + f"The port used in beeline command ({conn.port}) should be in range 0-65535)" + ) except (ValueError, TypeError) as e: - raise Exception(f"The port used in beeline command ({conn.port}) should be a valid integer: {e})") + raise ValueError( + f"The port used in beeline command ({conn.port}) should be a valid integer: {e})" + ) if ";" in conn.schema: - raise Exception( + raise ValueError( f"The schema used in beeline command ({conn.schema}) should not contain ';' character)" ) diff --git a/pyproject.toml b/pyproject.toml index 03a2ce9d66776..1787a96c353f2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -395,8 +395,6 @@ combine-as-imports = true # apache.hdfs "airflow/providers/apache/hdfs/hooks/hdfs.py" = ["TRY002"] "airflow/providers/apache/hdfs/sensors/hdfs.py" = ["TRY002"] -# apache.hive -"airflow/providers/apache/hive/hooks/hive.py" = ["TRY002"] # cncf.kubernetes "airflow/providers/cncf/kubernetes/operators/pod.py" = ["TRY002"] # common.sql