Skip to content

Commit 0eaadb9

Browse files
authored
Do not deprecate botocore_session (#1300)
* remove botocore_session deprecation message * add back DEPRECATED_BOTOCORE_SESSION * add deprecation message
1 parent e9c3170 commit 0eaadb9

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed

mkdocs/docs/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ catalog:
347347
<!-- prettier-ignore-start -->
348348

349349
!!! warning "Removed Properties"
350-
The properties `profile_name`, `region_name`, `botocore_session`, `aws_access_key_id`, `aws_secret_access_key`, and `aws_session_token` were deprecated and removed in 0.8.0
350+
The properties `profile_name`, `region_name`, `aws_access_key_id`, `aws_secret_access_key`, and `aws_session_token` were deprecated and removed in 0.8.0
351351

352352
<!-- prettier-ignore-end -->
353353

@@ -403,7 +403,7 @@ catalog:
403403
<!-- prettier-ignore-start -->
404404

405405
!!! warning "Removed Properties"
406-
The properties `profile_name`, `region_name`, `botocore_session`, `aws_access_key_id`, `aws_secret_access_key`, and `aws_session_token` were deprecated and removed in 0.8.0
406+
The properties `profile_name`, `region_name`, `aws_access_key_id`, `aws_secret_access_key`, and `aws_session_token` were deprecated and removed in 0.8.0
407407

408408
<!-- prettier-ignore-end -->
409409

pyiceberg/catalog/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
re.X,
107107
)
108108

109+
DEPRECATED_BOTOCORE_SESSION = "botocore_session"
110+
109111

110112
class CatalogType(Enum):
111113
REST = "rest"
@@ -779,6 +781,13 @@ class MetastoreCatalog(Catalog, ABC):
779781
def __init__(self, name: str, **properties: str):
780782
super().__init__(name, **properties)
781783

784+
if self.properties.get(DEPRECATED_BOTOCORE_SESSION):
785+
deprecation_message(
786+
deprecated_in="0.8.0",
787+
removed_in="0.9.0",
788+
help_message=f"The property {DEPRECATED_BOTOCORE_SESSION} is deprecated and will be removed.",
789+
)
790+
782791
def create_table_transaction(
783792
self,
784793
identifier: Union[str, Identifier],

pyiceberg/catalog/dynamodb.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import boto3
3131

3232
from pyiceberg.catalog import (
33+
DEPRECATED_BOTOCORE_SESSION,
3334
ICEBERG,
3435
METADATA_LOCATION,
3536
PREVIOUS_METADATA_LOCATION,
@@ -98,6 +99,7 @@ def __init__(self, name: str, **properties: str):
9899
session = boto3.Session(
99100
profile_name=properties.get(DYNAMODB_PROFILE_NAME),
100101
region_name=get_first_property_value(properties, DYNAMODB_REGION, AWS_REGION),
102+
botocore_session=properties.get(DEPRECATED_BOTOCORE_SESSION),
101103
aws_access_key_id=get_first_property_value(properties, DYNAMODB_ACCESS_KEY_ID, AWS_ACCESS_KEY_ID),
102104
aws_secret_access_key=get_first_property_value(properties, DYNAMODB_SECRET_ACCESS_KEY, AWS_SECRET_ACCESS_KEY),
103105
aws_session_token=get_first_property_value(properties, DYNAMODB_SESSION_TOKEN, AWS_SESSION_TOKEN),

pyiceberg/catalog/glue.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
)
4141

4242
from pyiceberg.catalog import (
43+
DEPRECATED_BOTOCORE_SESSION,
4344
EXTERNAL_TABLE,
4445
ICEBERG,
4546
LOCATION,
@@ -299,6 +300,7 @@ def __init__(self, name: str, **properties: Any):
299300
session = boto3.Session(
300301
profile_name=properties.get(GLUE_PROFILE_NAME),
301302
region_name=get_first_property_value(properties, GLUE_REGION, AWS_REGION),
303+
botocore_session=properties.get(DEPRECATED_BOTOCORE_SESSION),
302304
aws_access_key_id=get_first_property_value(properties, GLUE_ACCESS_KEY_ID, AWS_ACCESS_KEY_ID),
303305
aws_secret_access_key=get_first_property_value(properties, GLUE_SECRET_ACCESS_KEY, AWS_SECRET_ACCESS_KEY),
304306
aws_session_token=get_first_property_value(properties, GLUE_SESSION_TOKEN, AWS_SESSION_TOKEN),

tests/catalog/test_dynamodb.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ def test_passing_glue_session_properties() -> None:
585585
aws_session_token="dynamodb.session-token",
586586
region_name="dynamodb.region",
587587
profile_name="dynamodb.profile-name",
588+
botocore_session=None,
588589
)
589590
assert test_catalog.dynamodb is mock_session().client()
590591

@@ -608,6 +609,7 @@ def test_passing_unified_session_properties_to_dynamodb() -> None:
608609
aws_session_token="client.session-token",
609610
region_name="client.region",
610611
profile_name="dynamodb.profile-name",
612+
botocore_session=None,
611613
)
612614
assert test_catalog.dynamodb is mock_session().client()
613615

tests/catalog/test_glue.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ def test_passing_glue_session_properties() -> None:
657657
aws_session_token="glue.session-token",
658658
region_name="glue.region",
659659
profile_name="glue.profile-name",
660+
botocore_session=None,
660661
)
661662
assert test_catalog.glue is mock_session().client()
662663

@@ -677,6 +678,7 @@ def test_passing_unified_session_properties_to_glue() -> None:
677678
aws_session_token="client.session-token",
678679
region_name="client.region",
679680
profile_name="glue.profile-name",
681+
botocore_session=None,
680682
)
681683
assert test_catalog.glue is mock_session().client()
682684

0 commit comments

Comments
 (0)