Skip to content

Commit 9bbd661

Browse files
maxispeicherigorborgest
authored andcommitted
Add ExpectedBucketOwner as botocore kwarg
1 parent 2a70fe0 commit 9bbd661

File tree

12 files changed

+60
-26
lines changed

12 files changed

+60
-26
lines changed

awswrangler/athena/_read.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ def read_sql_query(
745745
The dict needs to contain the information in the form {'name': 'value'} and the SQL query needs to contain
746746
`:name;`.
747747
s3_additional_kwargs : Optional[Dict[str, Any]]
748-
Forward to botocore requests. Valid parameters: "RequestPayer".
748+
Forward to botocore requests. Valid parameters: "RequestPayer", "ExpectedBucketOwner".
749749
e.g. s3_additional_kwargs={'RequestPayer': 'requester'}
750750
751751
Returns
@@ -999,7 +999,7 @@ def read_sql_table(
999999
data_source : str, optional
10001000
Data Source / Catalog name. If None, 'AwsDataCatalog' will be used by default.
10011001
s3_additional_kwargs : Optional[Dict[str, Any]]
1002-
Forward to botocore requests. Valid parameters: "RequestPayer".
1002+
Forward to botocore requests. Valid parameters: "RequestPayer", "ExpectedBucketOwner".
10031003
e.g. s3_additional_kwargs={'RequestPayer': 'requester'}
10041004
10051005
Returns

awswrangler/athena/_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ def describe_table(
566566
kms_key : str, optional
567567
For SSE-KMS and CSE-KMS , this is the KMS key ARN or ID.
568568
s3_additional_kwargs : Optional[Dict[str, Any]]
569-
Forward to botocore requests. Valid parameters: "RequestPayer".
569+
Forward to botocore requests. Valid parameters: "RequestPayer", "ExpectedBucketOwner".
570570
e.g. s3_additional_kwargs={'RequestPayer': 'requester'}
571571
boto3_session : boto3.Session(), optional
572572
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
@@ -637,7 +637,7 @@ def show_create_table(
637637
kms_key : str, optional
638638
For SSE-KMS and CSE-KMS , this is the KMS key ARN or ID.
639639
s3_additional_kwargs : Optional[Dict[str, Any]]
640-
Forward to botocore requests. Valid parameters: "RequestPayer".
640+
Forward to botocore requests. Valid parameters: "RequestPayer", "ExpectedBucketOwner".
641641
e.g. s3_additional_kwargs={'RequestPayer': 'requester'}
642642
boto3_session : boto3.Session(), optional
643643
Boto3 Session. The default boto3 session will be used if boto3_session receive None.

awswrangler/redshift.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,8 @@ def copy_from_files( # pylint: disable=too-many-locals,too-many-arguments
11331133
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
11341134
s3_additional_kwargs:
11351135
Forward to botocore requests. Valid parameters: "ACL", "Metadata", "ServerSideEncryption", "StorageClass",
1136-
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging", "RequestPayer".
1136+
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging",
1137+
"RequestPayer", "ExpectedBucketOwner".
11371138
e.g. s3_additional_kwargs={'ServerSideEncryption': 'aws:kms', 'SSEKMSKeyId': 'YOUR_KMS_KEY_ARN'}
11381139
11391140
Returns
@@ -1311,7 +1312,8 @@ def copy( # pylint: disable=too-many-arguments
13111312
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
13121313
s3_additional_kwargs:
13131314
Forward to botocore requests. Valid parameters: "ACL", "Metadata", "ServerSideEncryption", "StorageClass",
1314-
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging", "RequestPayer".
1315+
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging",
1316+
"RequestPayer", "ExpectedBucketOwner".
13151317
e.g. s3_additional_kwargs={'ServerSideEncryption': 'aws:kms', 'SSEKMSKeyId': 'YOUR_KMS_KEY_ARN'}
13161318
max_rows_by_file : int
13171319
Max number of rows in each file.

awswrangler/s3/_copy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ def merge_datasets(
8484
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
8585
s3_additional_kwargs : Optional[Dict[str, Any]]
8686
Forward to botocore requests. Valid parameters: "ACL", "Metadata", "ServerSideEncryption", "StorageClass",
87-
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging".
87+
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging",
88+
"RequestPayer", "ExpectedBucketOwner".
8889
e.g. s3_additional_kwargs={'ServerSideEncryption': 'aws:kms', 'SSEKMSKeyId': 'YOUR_KMS_KEY_ARN'}
8990
9091
Returns
@@ -187,7 +188,8 @@ def copy_objects(
187188
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
188189
s3_additional_kwargs : Optional[Dict[str, Any]]
189190
Forward to botocore requests. Valid parameters: "ACL", "Metadata", "ServerSideEncryption", "StorageClass",
190-
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging".
191+
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging",
192+
"RequestPayer", "ExpectedBucketOwner".
191193
e.g. s3_additional_kwargs={'ServerSideEncryption': 'aws:kms', 'SSEKMSKeyId': 'YOUR_KMS_KEY_ARN'}
192194
193195
Returns

awswrangler/s3/_delete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def delete_objects(
119119
Filter the s3 files by the Last modified date of the object.
120120
The filter is applied only after list all s3 files.
121121
s3_additional_kwargs : Optional[Dict[str, Any]]
122-
Forward to botocore requests. Valid parameters: "RequestPayer".
122+
Forward to botocore requests. Valid parameters: "RequestPayer", "ExpectedBucketOwner".
123123
e.g. s3_additional_kwargs={'RequestPayer': 'requester'}
124124
boto3_session : boto3.Session(), optional
125125
Boto3 Session. The default boto3 session will be used if boto3_session receive None.

awswrangler/s3/_describe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def describe_objects(
8383
Filter the s3 files by the Last modified date of the object.
8484
The filter is applied only after list all s3 files.
8585
s3_additional_kwargs : Optional[Dict[str, Any]]
86-
Forward to botocore requests. Valid parameters: "RequestPayer".
86+
Forward to botocore requests. Valid parameters: "RequestPayer", "ExpectedBucketOwner".
8787
e.g. s3_additional_kwargs={'RequestPayer': 'requester'}
8888
boto3_session : boto3.Session(), optional
8989
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
@@ -162,7 +162,7 @@ def size_objects(
162162
True to enable concurrent requests, False to disable multiple threads.
163163
If enabled os.cpu_count() will be used as the max number of threads.
164164
s3_additional_kwargs : Optional[Dict[str, Any]]
165-
Forward to botocore requests. Valid parameters: "RequestPayer".
165+
Forward to botocore requests. Valid parameters: "RequestPayer", "ExpectedBucketOwner".
166166
e.g. s3_additional_kwargs={'RequestPayer': 'requester'}
167167
boto3_session : boto3.Session(), optional
168168
Boto3 Session. The default boto3 session will be used if boto3_session receive None.

awswrangler/s3/_fs.py

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
_MIN_PARALLEL_READ_BLOCK: int = 5_242_880 # 5 MB (5 * 2**20)
2626

2727
BOTOCORE_ACCEPTED_KWARGS: Dict[str, Set[str]] = {
28-
"get_object": {"SSECustomerAlgorithm", "SSECustomerKey", "RequestPayer"},
28+
"get_object": {
29+
"SSECustomerAlgorithm",
30+
"SSECustomerKey",
31+
"RequestPayer",
32+
"ExpectedBucketOwner",
33+
},
2934
"copy_object": {
3035
"ACL",
3136
"Metadata",
@@ -37,6 +42,7 @@
3742
"SSEKMSEncryptionContext",
3843
"Tagging",
3944
"RequestPayer",
45+
"ExpectedBucketOwner",
4046
},
4147
"create_multipart_upload": {
4248
"ACL",
@@ -49,9 +55,18 @@
4955
"SSEKMSEncryptionContext",
5056
"Tagging",
5157
"RequestPayer",
58+
"ExpectedBucketOwner",
59+
},
60+
"upload_part": {
61+
"SSECustomerAlgorithm",
62+
"SSECustomerKey",
63+
"RequestPayer",
64+
"ExpectedBucketOwner",
65+
},
66+
"complete_multipart_upload": {
67+
"RequestPayer",
68+
"ExpectedBucketOwner",
5269
},
53-
"upload_part": {"SSECustomerAlgorithm", "SSECustomerKey", "RequestPayer"},
54-
"complete_multipart_upload": {"RequestPayer"},
5570
"put_object": {
5671
"ACL",
5772
"Metadata",
@@ -63,10 +78,20 @@
6378
"SSEKMSEncryptionContext",
6479
"Tagging",
6580
"RequestPayer",
81+
"ExpectedBucketOwner",
82+
},
83+
"list_objects_v2": {
84+
"RequestPayer",
85+
"ExpectedBucketOwner",
86+
},
87+
"delete_objects": {
88+
"RequestPayer",
89+
"ExpectedBucketOwner",
90+
},
91+
"head_object": {
92+
"RequestPayer",
93+
"ExpectedBucketOwner",
6694
},
67-
"list_objects_v2": {"RequestPayer"},
68-
"delete_objects": {"RequestPayer"},
69-
"head_object": {"RequestPayer"},
7095
}
7196

7297

awswrangler/s3/_list.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def does_object_exist(
146146
path: str
147147
S3 path (e.g. s3://bucket/key).
148148
s3_additional_kwargs : Optional[Dict[str, Any]]
149-
Forward to botocore requests. Valid parameters: "RequestPayer".
149+
Forward to botocore requests. Valid parameters: "RequestPayer", "ExpectedBucketOwner".
150150
e.g. s3_additional_kwargs={'RequestPayer': 'requester'}
151151
boto3_session : boto3.Session(), optional
152152
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
@@ -209,7 +209,7 @@ def list_directories(
209209
path : str
210210
S3 path (e.g. s3://bucket/prefix).
211211
s3_additional_kwargs : Optional[Dict[str, Any]]
212-
Forward to botocore requests. Valid parameters: "RequestPayer".
212+
Forward to botocore requests. Valid parameters: "RequestPayer", "ExpectedBucketOwner".
213213
e.g. s3_additional_kwargs={'RequestPayer': 'requester'}
214214
boto3_session : boto3.Session(), optional
215215
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
@@ -277,7 +277,7 @@ def list_objects(
277277
ignore_empty: bool
278278
Ignore files with 0 bytes.
279279
s3_additional_kwargs : Optional[Dict[str, Any]]
280-
Forward to botocore requests. Valid parameters: "RequestPayer".
280+
Forward to botocore requests. Valid parameters: "RequestPayer", "ExpectedBucketOwner".
281281
e.g. s3_additional_kwargs={'RequestPayer': 'requester'}
282282
boto3_session : boto3.Session(), optional
283283
Boto3 Session. The default boto3 session will be used if boto3_session receive None.

awswrangler/s3/_write_excel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def to_excel(
4242
Boto3 Session. The default boto3 Session will be used if boto3_session receive None.
4343
s3_additional_kwargs : Optional[Dict[str, Any]]
4444
Forward to botocore requests. Valid parameters: "ACL", "Metadata", "ServerSideEncryption", "StorageClass",
45-
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging", "RequestPayer".
45+
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging",
46+
"RequestPayer", "ExpectedBucketOwner".
4647
e.g. s3_additional_kwargs={'ServerSideEncryption': 'aws:kms', 'SSEKMSKeyId': 'YOUR_KMS_KEY_ARN'}
4748
use_threads : bool
4849
True to enable concurrent requests, False to disable multiple threads.

awswrangler/s3/_write_parquet.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ def to_parquet( # pylint: disable=too-many-arguments,too-many-locals
269269
Boto3 Session. The default boto3 session will be used if boto3_session receive None.
270270
s3_additional_kwargs : Optional[Dict[str, Any]]
271271
Forward to botocore requests. Valid parameters: "ACL", "Metadata", "ServerSideEncryption", "StorageClass",
272-
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging", "RequestPayer".
272+
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging",
273+
"RequestPayer", "ExpectedBucketOwner".
273274
e.g. s3_additional_kwargs={'ServerSideEncryption': 'aws:kms', 'SSEKMSKeyId': 'YOUR_KMS_KEY_ARN'}
274275
sanitize_columns : bool
275276
True to sanitize columns names (using `wr.catalog.sanitize_table_name` and `wr.catalog.sanitize_column_name`)
@@ -736,7 +737,8 @@ def store_parquet_metadata( # pylint: disable=too-many-arguments
736737
(e.g. {'col_name': '1', 'col2_name': '2'})
737738
s3_additional_kwargs : Optional[Dict[str, Any]]
738739
Forward to botocore requests. Valid parameters: "ACL", "Metadata", "ServerSideEncryption", "StorageClass",
739-
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging", "RequestPayer".
740+
"SSECustomerAlgorithm", "SSECustomerKey", "SSEKMSKeyId", "SSEKMSEncryptionContext", "Tagging",
741+
"RequestPayer", "ExpectedBucketOwner".
740742
e.g. s3_additional_kwargs={'ServerSideEncryption': 'aws:kms', 'SSEKMSKeyId': 'YOUR_KMS_KEY_ARN'}
741743
boto3_session : boto3.Session(), optional
742744
Boto3 Session. The default boto3 session will be used if boto3_session receive None.

0 commit comments

Comments
 (0)