Skip to content

Commit 2b9b074

Browse files
Merge upstream main into fix-3713-empty-property-helpers
2 parents da08999 + 03ad0d6 commit 2b9b074

21 files changed

Lines changed: 569 additions & 121 deletions

‎.github/workflows/codeql.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ jobs:
4646
persist-credentials: false
4747

4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
49+
uses: github/codeql-action/init@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
5050
with:
5151
languages: actions
5252

5353
- name: Perform CodeQL Analysis
54-
uses: github/codeql-action/analyze@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4.37.4
54+
uses: github/codeql-action/analyze@5595ccaf912efad79be6eef63a5619ff05969be3 # v4.37.6
5555
with:
5656
category: "/language:actions"

‎.github/workflows/pypi-build-artifacts.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
if: matrix.os == 'ubuntu-latest'
7070

7171
- name: Build wheels
72-
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
72+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
7373
with:
7474
output-dir: wheelhouse
7575
config-file: "pyproject.toml"

‎.github/workflows/stale.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
if: github.repository_owner == 'apache'
3333
runs-on: ubuntu-latest
3434
steps:
35-
- uses: actions/stale@1e223db275d687790206a7acac4d1a11bd6fe629 # v10.4.0
35+
- uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0
3636
with:
3737
# stale issues
3838
stale-issue-label: 'stale'

‎.github/workflows/svn-build-artifacts.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
if: matrix.os == 'ubuntu-latest'
6464

6565
- name: Build wheels
66-
uses: pypa/cibuildwheel@4726cd35bb13f7bde50cf2761f2499ac7b3aa32c # v4.1.1
66+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
6767
with:
6868
output-dir: wheelhouse
6969
config-file: "pyproject.toml"

‎mkdocs/docs/configuration.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ For the FileIO there are several configuration options available:
172172
| s3.force-virtual-addressing | False | Whether to use virtual addressing of buckets. If true, then virtual addressing is always enabled. If false, then virtual addressing is only enabled if endpoint_override is empty. This can be used for non-AWS backends that only support virtual hosted-style access. |
173173
| s3.retry-strategy-impl | None | Ability to set a custom S3 retry strategy. A full path to a class needs to be given that extends the [S3RetryStrategy](https://github.com/apache/arrow/blob/639201bfa412db26ce45e73851432018af6c945e/python/pyarrow/_s3fs.pyx#L110) base class. |
174174
| s3.anonymous | True | Configure whether to use anonymous connection. If False (default), uses key/secret if configured or boto's credential resolver. |
175+
| s3.server-side-encryption | aws:kms | Configure server-side encryption (e.g. `AES256` or `aws:kms`). Only supported by `FsspecFileIO`. |
176+
| s3.sse-kms-key-id | alias/my-key | Configure the SSE-KMS key id (or ARN) for multipart uploads. Only supported by `FsspecFileIO`. |
175177

176178
<!-- markdown-link-check-enable-->
177179

‎pyiceberg/catalog/dynamodb.py‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,10 @@ def _get_update_database_item(namespace_item: dict[str, Any], updated_properties
837837

838838

839839
def _get_namespace_properties(namespace_dict: dict[str, str]) -> Properties:
840-
return {_remove_property_prefix(key): val for key, val in namespace_dict.items() if key.startswith(PROPERTY_KEY_PREFIX)}
840+
# removeprefix removes the literal prefix, unlike lstrip which removes any leading prefix characters
841+
return {
842+
key.removeprefix(PROPERTY_KEY_PREFIX): val for key, val in namespace_dict.items() if key.startswith(PROPERTY_KEY_PREFIX)
843+
}
841844

842845

843846
def _convert_dynamo_item_to_regular_dict(dynamo_json: dict[str, Any]) -> dict[str, str]:
@@ -888,7 +891,3 @@ def _convert_dynamo_item_to_regular_dict(dynamo_json: dict[str, Any]) -> dict[st
888891

889892
def _add_property_prefix(prop: str) -> str:
890893
return PROPERTY_KEY_PREFIX + prop
891-
892-
893-
def _remove_property_prefix(prop: str) -> str:
894-
return prop.lstrip(PROPERTY_KEY_PREFIX)

‎pyiceberg/expressions/literals.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def __init__(self) -> None:
251251

252252
@singledispatchmethod
253253
def to(self, type_var: IcebergType) -> Literal: # type: ignore
254-
raise TypeError("Cannot change the type of IntAboveMax")
254+
raise TypeError("Cannot change the type of LongAboveMax")
255255

256256
@to.register(LongType)
257257
def _(self, _: LongType) -> Literal[int]:
@@ -264,7 +264,7 @@ def __init__(self) -> None:
264264

265265
@singledispatchmethod
266266
def to(self, type_var: IcebergType) -> Literal: # type: ignore
267-
raise TypeError("Cannot change the type of IntBelowMin")
267+
raise TypeError("Cannot change the type of LongBelowMin")
268268

269269
@to.register(LongType)
270270
def _(self, _: LongType) -> Literal[int]:

‎pyiceberg/io/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ def _is_local_path(path: str) -> bool:
8080
S3_ROLE_SESSION_NAME = "s3.role-session-name"
8181
S3_FORCE_VIRTUAL_ADDRESSING = "s3.force-virtual-addressing"
8282
S3_RETRY_STRATEGY_IMPL = "s3.retry-strategy-impl"
83+
S3_SERVER_SIDE_ENCRYPTION = "s3.server-side-encryption"
84+
S3_SSE_KMS_KEY_ID = "s3.sse-kms-key-id"
8385
HDFS_HOST = "hdfs.host"
8486
HDFS_PORT = "hdfs.port"
8587
HDFS_USER = "hdfs.user"

‎pyiceberg/io/fsspec.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@
7979
S3_REGION,
8080
S3_REQUEST_TIMEOUT,
8181
S3_SECRET_ACCESS_KEY,
82+
S3_SERVER_SIDE_ENCRYPTION,
8283
S3_SESSION_TOKEN,
8384
S3_SIGNER,
8485
S3_SIGNER_ENDPOINT,
8586
S3_SIGNER_ENDPOINT_DEFAULT,
8687
S3_SIGNER_URI,
88+
S3_SSE_KMS_KEY_ID,
8789
FileIO,
8890
InputFile,
8991
InputStream,
@@ -178,6 +180,7 @@ def _s3(properties: Properties) -> AbstractFileSystem:
178180
"region_name": get_first_property_value(properties, S3_REGION, AWS_REGION),
179181
}
180182
config_kwargs = {}
183+
s3_additional_kwargs = {}
181184
register_events: dict[str, Callable[[AWSRequest], None]] = {}
182185

183186
if signer := properties.get(S3_SIGNER):
@@ -202,14 +205,20 @@ def _s3(properties: Properties) -> AbstractFileSystem:
202205
if request_timeout := properties.get(S3_REQUEST_TIMEOUT):
203206
config_kwargs["read_timeout"] = float(request_timeout)
204207

205-
if _force_virtual_addressing := properties.get(S3_FORCE_VIRTUAL_ADDRESSING):
208+
if property_as_bool(properties, S3_FORCE_VIRTUAL_ADDRESSING, False):
206209
config_kwargs["s3"] = {"addressing_style": "virtual"}
207210

208211
if s3_anonymous := properties.get(S3_ANONYMOUS):
209212
anon = strtobool(s3_anonymous)
210213
else:
211214
anon = False
212215

216+
if server_side_encryption := properties.get(S3_SERVER_SIDE_ENCRYPTION):
217+
s3_additional_kwargs["ServerSideEncryption"] = server_side_encryption
218+
219+
if sse_kms_key_id := properties.get(S3_SSE_KMS_KEY_ID):
220+
s3_additional_kwargs["SSEKMSKeyId"] = sse_kms_key_id
221+
213222
s3_fs_kwargs = {
214223
"anon": anon,
215224
"client_kwargs": client_kwargs,
@@ -219,6 +228,9 @@ def _s3(properties: Properties) -> AbstractFileSystem:
219228
if profile_name := get_first_property_value(properties, S3_PROFILE_NAME, AWS_PROFILE_NAME):
220229
s3_fs_kwargs["profile"] = profile_name
221230

231+
if s3_additional_kwargs:
232+
s3_fs_kwargs["s3_additional_kwargs"] = s3_additional_kwargs
233+
222234
fs = S3FileSystem(**s3_fs_kwargs)
223235

224236
for event_name, event_function in register_events.items():

‎pyiceberg/partitioning.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ def _to_partition_representation(type: IcebergType, value: Any) -> Any:
500500
can return date that still needs to be transformed into an int (days
501501
since epoch).
502502
"""
503-
return TypeError(f"Unsupported partition field type: {type}")
503+
raise TypeError(f"Unsupported partition field type: {type}")
504504

505505

506506
@_to_partition_representation.register(TimestampType)

0 commit comments

Comments
 (0)