rchowell opened a new issue, #1910:
URL: https://github.com/apache/iceberg-python/issues/1910
### Feature Request / Improvement
Sometimes I have my own boto3 client which I would like to use as the
GlueCatalog client. Perhaps an optional client constructor parameter or an
alternative constructor can address this.
```python
class GlueCatalog(MetastoreCatalog):
def __init__(self, name: str, client: GlueClient | None = None,
**properties: Any):
super().__init__(name, **properties)
retry_mode_prop_value = get_first_property_value(properties,
GLUE_RETRY_MODE)
if client:
self.glue = client
else:
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(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),
)
self.glue: GlueClient = session.client(
"glue",
endpoint_url=properties.get(GLUE_CATALOG_ENDPOINT),
config=Config(
retries={
"max_attempts": properties.get(GLUE_MAX_RETRIES,
MAX_RETRIES),
"mode": retry_mode_prop_value if
retry_mode_prop_value in EXISTING_RETRY_MODES else STANDARD_RETRY_MODE,
}
),
)
```
Currently I am using `__new__` to set this myself, but perhaps poor
practice, and it's not clear at the moment which missing properties may impact
me later.
```python
gc = GlueCatalog.__new__(GlueCatalog)
gc.name = my_name
gc.properties = {}
gc.glue = my_client # <-----
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]