-
Notifications
You must be signed in to change notification settings - Fork 166
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
Standardize AWS credential names #922
Changes from all commits
1310b0e
953a883
f7384e9
0abae8f
94337c2
996c874
ce5b604
a67f549
7a85275
846fc08
c91aaeb
964132f
fd2af56
dd65c6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -39,6 +39,12 @@ | |||
) | ||||
|
||||
from pyiceberg.catalog import ( | ||||
DEPRECATED_ACCESS_KEY_ID, | ||||
DEPRECATED_BOTOCORE_SESSION, | ||||
DEPRECATED_PROFILE_NAME, | ||||
DEPRECATED_REGION, | ||||
DEPRECATED_SECRET_ACCESS_KEY, | ||||
DEPRECATED_SESSION_TOKEN, | ||||
EXTERNAL_TABLE, | ||||
ICEBERG, | ||||
LOCATION, | ||||
|
@@ -58,6 +64,7 @@ | |||
NoSuchTableError, | ||||
TableAlreadyExistsError, | ||||
) | ||||
from pyiceberg.io import AWS_ACCESS_KEY_ID, AWS_REGION, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN | ||||
from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionSpec | ||||
from pyiceberg.schema import Schema, SchemaVisitor, visit | ||||
from pyiceberg.serializers import FromInputFile | ||||
|
@@ -117,6 +124,12 @@ | |||
ICEBERG_FIELD_OPTIONAL = "iceberg.field.optional" | ||||
ICEBERG_FIELD_CURRENT = "iceberg.field.current" | ||||
|
||||
GLUE_PROFILE_NAME = "glue.profile-name" | ||||
GLUE_REGION = "glue.region" | ||||
GLUE_ACCESS_KEY_ID = "glue.access-key-id" | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How common is it to have a separate iceberg-python/pyiceberg/io/pyarrow.py Line 349 in 3f44dfe
This way you would need to set both I'm not an AWS expert, but my gut feeling is that normally people rely on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestions! I've updated the doc to explicitly indicating that
The I added a separate section There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense, I'm good with that now. At some point we should have a bigger conversation across languages to unify this. |
||||
GLUE_SECRET_ACCESS_KEY = "glue.secret-access-key" | ||||
GLUE_SESSION_TOKEN = "glue.session-token" | ||||
|
||||
|
||||
def _construct_parameters( | ||||
metadata_location: str, glue_table: Optional[TableTypeDef] = None, prev_metadata_location: Optional[str] = None | ||||
|
@@ -285,13 +298,21 @@ class GlueCatalog(MetastoreCatalog): | |||
def __init__(self, name: str, **properties: Any): | ||||
super().__init__(name, **properties) | ||||
|
||||
from pyiceberg.table import PropertyUtil | ||||
|
||||
session = boto3.Session( | ||||
profile_name=properties.get("profile_name"), | ||||
region_name=properties.get("region_name"), | ||||
botocore_session=properties.get("botocore_session"), | ||||
aws_access_key_id=properties.get("aws_access_key_id"), | ||||
aws_secret_access_key=properties.get("aws_secret_access_key"), | ||||
aws_session_token=properties.get("aws_session_token"), | ||||
profile_name=PropertyUtil.get_first_property_value(properties, GLUE_PROFILE_NAME, DEPRECATED_PROFILE_NAME), | ||||
region_name=PropertyUtil.get_first_property_value(properties, GLUE_REGION, AWS_REGION, DEPRECATED_REGION), | ||||
botocore_session=properties.get(DEPRECATED_BOTOCORE_SESSION), | ||||
aws_access_key_id=PropertyUtil.get_first_property_value( | ||||
properties, GLUE_ACCESS_KEY_ID, AWS_ACCESS_KEY_ID, DEPRECATED_ACCESS_KEY_ID | ||||
), | ||||
aws_secret_access_key=PropertyUtil.get_first_property_value( | ||||
properties, GLUE_SECRET_ACCESS_KEY, AWS_SECRET_ACCESS_KEY, DEPRECATED_SECRET_ACCESS_KEY | ||||
), | ||||
aws_session_token=PropertyUtil.get_first_property_value( | ||||
properties, GLUE_SESSION_TOKEN, AWS_SESSION_TOKEN, DEPRECATED_SESSION_TOKEN | ||||
), | ||||
) | ||||
self.glue: GlueClient = session.client("glue", endpoint_url=properties.get(GLUE_CATALOG_ENDPOINT)) | ||||
|
||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,10 @@ | |
|
||
logger = logging.getLogger(__name__) | ||
|
||
AWS_REGION = "client.region" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I chose There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice, that's a good find 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be good to highlight this in the PR description! |
||
AWS_ACCESS_KEY_ID = "client.access-key-id" | ||
AWS_SECRET_ACCESS_KEY = "client.secret-access-key" | ||
AWS_SESSION_TOKEN = "client.session-token" | ||
S3_ENDPOINT = "s3.endpoint" | ||
S3_ACCESS_KEY_ID = "s3.access-key-id" | ||
S3_SECRET_ACCESS_KEY = "s3.secret-access-key" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,6 +253,13 @@ def property_as_bool(properties: Dict[str, str], property_name: str, default: bo | |
return value.lower() == "true" | ||
return default | ||
|
||
@staticmethod | ||
def get_first_property_value(properties: Properties, *property_names: str) -> Optional[Any]: | ||
for property_name in property_names: | ||
if property_value := properties.get(property_name): | ||
return property_value | ||
return None | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may be in a follow-up PR: I am considering whether it is worth moving the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. We can probably reorganize many of our functions to avoid circular dependencies 🙂 |
||
|
||
class Transaction: | ||
_table: Table | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it may be more reasonable to stop exposing the
botocore_session
configuration:Dict[str, str]