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

Do not deprecate botocore_session #1300

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions mkdocs/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ catalog:
<!-- prettier-ignore-start -->

!!! warning "Removed Properties"
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
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

<!-- prettier-ignore-end -->

Expand Down Expand Up @@ -403,7 +403,7 @@ catalog:
<!-- prettier-ignore-start -->

!!! warning "Removed Properties"
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
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

<!-- prettier-ignore-end -->

Expand Down
2 changes: 2 additions & 0 deletions pyiceberg/catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
re.X,
)

DEPRECATED_BOTOCORE_SESSION = "botocore_session"


class CatalogType(Enum):
REST = "rest"
Expand Down
2 changes: 2 additions & 0 deletions pyiceberg/catalog/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import boto3

from pyiceberg.catalog import (
DEPRECATED_BOTOCORE_SESSION,
ICEBERG,
METADATA_LOCATION,
PREVIOUS_METADATA_LOCATION,
Expand Down Expand Up @@ -98,6 +99,7 @@ def __init__(self, name: str, **properties: str):
session = boto3.Session(
profile_name=properties.get(DYNAMODB_PROFILE_NAME),
region_name=get_first_property_value(properties, DYNAMODB_REGION, AWS_REGION),
botocore_session=properties.get(DEPRECATED_BOTOCORE_SESSION),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to emit a deprecation message? I feel like there is no strong consensus on how to move this forward, and I would also love to get @HonahX's input on it. Same for Glue below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im ok with leaving it as is now, and deferring to the next release

aws_access_key_id=get_first_property_value(properties, DYNAMODB_ACCESS_KEY_ID, AWS_ACCESS_KEY_ID),
aws_secret_access_key=get_first_property_value(properties, DYNAMODB_SECRET_ACCESS_KEY, AWS_SECRET_ACCESS_KEY),
aws_session_token=get_first_property_value(properties, DYNAMODB_SESSION_TOKEN, AWS_SESSION_TOKEN),
Expand Down
2 changes: 2 additions & 0 deletions pyiceberg/catalog/glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
)

from pyiceberg.catalog import (
DEPRECATED_BOTOCORE_SESSION,
EXTERNAL_TABLE,
ICEBERG,
LOCATION,
Expand Down Expand Up @@ -299,6 +300,7 @@ def __init__(self, name: str, **properties: Any):
session = boto3.Session(
profile_name=properties.get(GLUE_PROFILE_NAME),
region_name=get_first_property_value(properties, GLUE_REGION, AWS_REGION),
botocore_session=properties.get(DEPRECATED_BOTOCORE_SESSION),
aws_access_key_id=get_first_property_value(properties, GLUE_ACCESS_KEY_ID, AWS_ACCESS_KEY_ID),
aws_secret_access_key=get_first_property_value(properties, GLUE_SECRET_ACCESS_KEY, AWS_SECRET_ACCESS_KEY),
aws_session_token=get_first_property_value(properties, GLUE_SESSION_TOKEN, AWS_SESSION_TOKEN),
Expand Down
2 changes: 2 additions & 0 deletions tests/catalog/test_dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ def test_passing_glue_session_properties() -> None:
aws_session_token="dynamodb.session-token",
region_name="dynamodb.region",
profile_name="dynamodb.profile-name",
botocore_session=None,
)
assert test_catalog.dynamodb is mock_session().client()

Expand All @@ -608,6 +609,7 @@ def test_passing_unified_session_properties_to_dynamodb() -> None:
aws_session_token="client.session-token",
region_name="client.region",
profile_name="dynamodb.profile-name",
botocore_session=None,
)
assert test_catalog.dynamodb is mock_session().client()

Expand Down
2 changes: 2 additions & 0 deletions tests/catalog/test_glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ def test_passing_glue_session_properties() -> None:
aws_session_token="glue.session-token",
region_name="glue.region",
profile_name="glue.profile-name",
botocore_session=None,
)
assert test_catalog.glue is mock_session().client()

Expand All @@ -677,6 +678,7 @@ def test_passing_unified_session_properties_to_glue() -> None:
aws_session_token="client.session-token",
region_name="client.region",
profile_name="glue.profile-name",
botocore_session=None,
)
assert test_catalog.glue is mock_session().client()

Expand Down