diff --git a/pyiceberg/catalog/__init__.py b/pyiceberg/catalog/__init__.py index 2104fcab7a..f5050d26b4 100644 --- a/pyiceberg/catalog/__init__.py +++ b/pyiceberg/catalog/__init__.py @@ -106,6 +106,8 @@ re.X, ) +DEPRECATED_BOTOCORE_SESSION = "botocore_session" + class CatalogType(Enum): REST = "rest" diff --git a/pyiceberg/catalog/dynamodb.py b/pyiceberg/catalog/dynamodb.py index b999df218a..6dfb243a42 100644 --- a/pyiceberg/catalog/dynamodb.py +++ b/pyiceberg/catalog/dynamodb.py @@ -30,6 +30,7 @@ import boto3 from pyiceberg.catalog import ( + DEPRECATED_BOTOCORE_SESSION, ICEBERG, METADATA_LOCATION, PREVIOUS_METADATA_LOCATION, @@ -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), 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), diff --git a/pyiceberg/catalog/glue.py b/pyiceberg/catalog/glue.py index 385873c45b..5742173fa6 100644 --- a/pyiceberg/catalog/glue.py +++ b/pyiceberg/catalog/glue.py @@ -40,6 +40,7 @@ ) from pyiceberg.catalog import ( + DEPRECATED_BOTOCORE_SESSION, EXTERNAL_TABLE, ICEBERG, LOCATION, @@ -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), diff --git a/tests/catalog/test_dynamodb.py b/tests/catalog/test_dynamodb.py index 194caf46b7..0f89d12642 100644 --- a/tests/catalog/test_dynamodb.py +++ b/tests/catalog/test_dynamodb.py @@ -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() @@ -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() diff --git a/tests/catalog/test_glue.py b/tests/catalog/test_glue.py index 41b196facf..26c80bc968 100644 --- a/tests/catalog/test_glue.py +++ b/tests/catalog/test_glue.py @@ -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() @@ -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()