From df36e7381ac50202568b339803fd8b78c6ed205e Mon Sep 17 00:00:00 2001 From: Hussein Awala Date: Thu, 30 Nov 2023 14:55:52 +0200 Subject: [PATCH] Use S3 hook instead of AwsGenericHook in AWS S3 FS (#35973) --- airflow/providers/amazon/aws/fs/s3.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/airflow/providers/amazon/aws/fs/s3.py b/airflow/providers/amazon/aws/fs/s3.py index d64adc401f0ee..525fa2b9dd643 100644 --- a/airflow/providers/amazon/aws/fs/s3.py +++ b/airflow/providers/amazon/aws/fs/s3.py @@ -25,7 +25,7 @@ from botocore import UNSIGNED from requests import HTTPError -from airflow.providers.amazon.aws.hooks.base_aws import AwsGenericHook +from airflow.providers.amazon.aws.hooks.s3 import S3Hook if TYPE_CHECKING: from botocore.awsrequest import AWSRequest @@ -55,14 +55,14 @@ def get_fs(conn_id: str | None) -> AbstractFileSystem: "pip install apache-airflow-providers-amazon[s3fs]" ) - aws: AwsGenericHook = AwsGenericHook(aws_conn_id=conn_id, client_type="s3") - session = aws.get_session(deferrable=True) - endpoint_url = aws.conn_config.get_service_endpoint_url(service_name="s3") + s3_hook = S3Hook(aws_conn_id=conn_id) + session = s3_hook.get_session(deferrable=True) + endpoint_url = s3_hook.conn_config.get_service_endpoint_url(service_name="s3") - config_kwargs: dict[str, Any] = aws.conn_config.extra_config.get("config_kwargs", {}) + config_kwargs: dict[str, Any] = s3_hook.conn_config.extra_config.get("config_kwargs", {}) register_events: dict[str, Callable[[Properties], None]] = {} - s3_service_config = aws.service_config + s3_service_config = s3_hook.service_config if signer := s3_service_config.get("signer", None): log.info("Loading signer %s", signer) if singer_func := SIGNERS.get(signer):