Skip to content

Commit

Permalink
AWS: Undeprecate botocore_session (#1692)
Browse files Browse the repository at this point in the history
We've deprecated this a while ago, because as the configuration should
only pass in strings, and not Python objects.

However, it was pretty complex to find a reasonable alternative for
this. For example: #1299

Therefore, I think we should undo this deprecation for now.
  • Loading branch information
Fokko authored Feb 20, 2025
1 parent d1fea5c commit 8cb8793
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
12 changes: 1 addition & 11 deletions pyiceberg/catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@
RecursiveDict,
)
from pyiceberg.utils.config import Config, merge_config
from pyiceberg.utils.deprecated import deprecated as deprecated
from pyiceberg.utils.deprecated import deprecation_message
from pyiceberg.utils.properties import property_as_bool

if TYPE_CHECKING:
Expand All @@ -98,6 +96,7 @@
URI = "uri"
LOCATION = "location"
EXTERNAL_TABLE = "EXTERNAL_TABLE"
BOTOCORE_SESSION = "botocore_session"

TABLE_METADATA_FILE_NAME_REGEX = re.compile(
r"""
Expand All @@ -110,8 +109,6 @@
re.X,
)

DEPRECATED_BOTOCORE_SESSION = "botocore_session"


class CatalogType(Enum):
REST = "rest"
Expand Down Expand Up @@ -784,13 +781,6 @@ class MetastoreCatalog(Catalog, ABC):
def __init__(self, name: str, **properties: str):
super().__init__(name, **properties)

if self.properties.get(DEPRECATED_BOTOCORE_SESSION):
deprecation_message(
deprecated_in="0.8.0",
removed_in="0.9.0",
help_message=f"The property {DEPRECATED_BOTOCORE_SESSION} is deprecated and will be removed.",
)

def create_table_transaction(
self,
identifier: Union[str, Identifier],
Expand Down
4 changes: 2 additions & 2 deletions pyiceberg/catalog/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import boto3

from pyiceberg.catalog import (
DEPRECATED_BOTOCORE_SESSION,
BOTOCORE_SESSION,
ICEBERG,
METADATA_LOCATION,
PREVIOUS_METADATA_LOCATION,
Expand Down Expand Up @@ -100,7 +100,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),
botocore_session=properties.get(BOTOCORE_SESSION),
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
4 changes: 2 additions & 2 deletions pyiceberg/catalog/glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
)

from pyiceberg.catalog import (
DEPRECATED_BOTOCORE_SESSION,
BOTOCORE_SESSION,
EXTERNAL_TABLE,
ICEBERG,
LOCATION,
Expand Down Expand Up @@ -311,7 +311,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),
botocore_session=properties.get(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

0 comments on commit 8cb8793

Please sign in to comment.