Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use S3 hook instead of AwsGenericHook in AWS S3 FS #35973

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions airflow/providers/amazon/aws/fs/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down