Taragolis commented on code in PR #29452:
URL: https://github.com/apache/airflow/pull/29452#discussion_r1130848667
##########
airflow/providers/amazon/aws/transfers/dynamodb_to_s3.py:
##########
@@ -118,10 +138,16 @@ def __init__(
self.dynamodb_scan_kwargs = dynamodb_scan_kwargs
self.s3_bucket_name = s3_bucket_name
self.s3_key_prefix = s3_key_prefix
- self.aws_conn_id = aws_conn_id
+ if aws_conn_id is not NOTSET:
Review Comment:
```suggestion
if not isinstance(aws_conn_id, ArgNotSet):
```
##########
airflow/providers/amazon/aws/transfers/dynamodb_to_s3.py:
##########
@@ -52,9 +60,15 @@ def _convert_item_to_json_bytes(item: dict[str, Any]) ->
bytes:
def _upload_file_to_s3(
- file_obj: IO, bucket_name: str, s3_key_prefix: str, aws_conn_id: str =
"aws_default"
+ file_obj: IO,
+ bucket_name: str,
+ s3_key_prefix: str,
+ aws_conn_id: str | None | ArgNotSet = AwsBaseHook.default_conn_name,
Review Comment:
```suggestion
aws_conn_id: str | None = AwsBaseHook.default_conn_name,
```
##########
airflow/providers/amazon/aws/transfers/dynamodb_to_s3.py:
##########
@@ -52,9 +60,15 @@ def _convert_item_to_json_bytes(item: dict[str, Any]) ->
bytes:
def _upload_file_to_s3(
- file_obj: IO, bucket_name: str, s3_key_prefix: str, aws_conn_id: str =
"aws_default"
+ file_obj: IO,
+ bucket_name: str,
+ s3_key_prefix: str,
+ aws_conn_id: str | None | ArgNotSet = AwsBaseHook.default_conn_name,
) -> None:
- s3_client = S3Hook(aws_conn_id=aws_conn_id).get_conn()
+ if isinstance(aws_conn_id, str) or aws_conn_id is None:
+ s3_client = S3Hook(aws_conn_id=aws_conn_id).get_conn()
+ else:
+ s3_client = S3Hook().get_conn()
Review Comment:
```suggestion
s3_client = S3Hook(aws_conn_id=aws_conn_id).get_conn()
```
##########
airflow/providers/amazon/aws/transfers/dynamodb_to_s3.py:
##########
@@ -118,10 +138,16 @@ def __init__(
self.dynamodb_scan_kwargs = dynamodb_scan_kwargs
self.s3_bucket_name = s3_bucket_name
self.s3_key_prefix = s3_key_prefix
- self.aws_conn_id = aws_conn_id
+ if aws_conn_id is not NOTSET:
+ warnings.warn(_DEPRECATION_MSG, DeprecationWarning, stacklevel=3)
+ self.source_aws_conn_id = aws_conn_id
+ else:
+ self.source_aws_conn_id = source_aws_conn_id
+ if dest_aws_conn_id is NOTSET:
+ self.dest_aws_conn_id = self.source_aws_conn_id
Review Comment:
```suggestion
self.dest_aws_conn_id = (
self.source_aws_conn_id if isinstance(dest_aws_conn_id,
ArgNotSet) else dest_aws_conn_id
)
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]