Skip to content

Conversation

@rchowell
Copy link
Contributor

Closes #1910

Rationale for this change

When working with the GlueCatalog, I may already have a GlueClient that I've instantiated from elsewhere, and perhaps wish to keep. This allows passing our client to the GlueCatalog constructor so that we aren't forced into getting a new client.

This is slightly interesting because it's the only catalog that now has a different constructor signature. Also it may be odd for users to pass a client, but then none of their properties (which may have retry configs) are applied.

An alternative to consider is having a from_client or with_client staticmethod, but I did not see precedence elsewhere. I will leave it to the maintainers to decide which they prefer and will update accordingly. Similarly, I can do the same for dynamodb 🙂

I've also skipped the event_handler for a user-provided client because I wouldn't want to impede on their existing events, also the param is optional. Something to consider is using the unique_id arg when registering an event.

If a unique_id is given, the handler will not be registered
if a handler with the unique_id has already been registered.

Are these changes tested?

Basic unit test to assert the client passed is the client used.

Are there any user-facing changes?

I believe so since this is an addition to the public API.

@jayceslesar
Copy link
Contributor

Nice, I can see myself re-using the client I would instantiate in a custom resource to run infra changes on my iceberg tables through CDK!

@Fokko
Copy link
Contributor

Fokko commented Apr 16, 2025

Thanks for working on this @rchowell I've left some small comments, but it looks good in general 👍

Copy link
Contributor

@kevinjqliu kevinjqliu left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +344 to +345
if glue_catalog_id := properties.get(GLUE_ID):
_register_glue_catalog_id_with_glue_client(self.glue, glue_catalog_id)
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 also need to call this when the client is passed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kevinjqliu good question, I left this out intentionally so that we do not make any modifications to the customer's input client / impede on their existing events. Since the catalog_id parameter is optional, it doesn't make a functional difference afaik. Something to consider is using the unique_id arg when registering an event. Let me know what you think, and I can follow-up 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 i think its a good idea to not modify the input client. Its assumed that using the custom client means its already pre-configured before passing here

@kevinjqliu kevinjqliu merged commit f5978bb into apache:main Apr 21, 2025
7 checks passed
@kevinjqliu
Copy link
Contributor

Thanks for the contribution @rchowell!

Fokko pushed a commit that referenced this pull request Jun 11, 2025
3 changes here...

1. Basically a mirror of
#1920 but for dynamo
2. Allow users to pass in an existing client/pass initialize client with
properties in `RestCatalog` with sigv4 enabled. (closes #2070, closes
#2008)
3. Re-use of the client in `add_headers` in `RestCatalog` with sigv4.
(closes #2069 )

---------

Co-authored-by: Marko Grujic <[email protected]>
amitgilad3 pushed a commit to amitgilad3/iceberg-python that referenced this pull request Jul 7, 2025
3 changes here...

1. Basically a mirror of
apache#1920 but for dynamo
2. Allow users to pass in an existing client/pass initialize client with
properties in `RestCatalog` with sigv4 enabled. (closes apache#2070, closes
apache#2008)
3. Re-use of the client in `add_headers` in `RestCatalog` with sigv4.
(closes apache#2069 )

---------

Co-authored-by: Marko Grujic <[email protected]>
gabeiglio pushed a commit to Netflix/iceberg-python that referenced this pull request Aug 13, 2025
Closes apache#1910 

# Rationale for this change

When working with the GlueCatalog, I may already have a GlueClient that
I've instantiated from elsewhere, and perhaps wish to keep. This allows
passing our client to the GlueCatalog constructor so that we aren't
forced into getting a new client.

This is slightly interesting because it's the only catalog that now has
a different constructor signature. Also it may be odd for users to pass
a client, but then none of their properties (which may have retry
configs) are applied.

An alternative to consider is having a `from_client` or `with_client`
staticmethod, but I did not see precedence elsewhere. I will leave it to
the maintainers to decide which they prefer and will update accordingly.
Similarly, I can do the same for dynamodb 🙂

I've also skipped the event_handler for a user-provided client because I
wouldn't want to impede on their existing events, also the param is
optional. Something to consider is using the [unique_id
arg](https://github.com/boto/botocore/blob/aaa6690e45c8dabcde3a8d2d1aa34b5fd399fba7/botocore/hooks.py#L89)
when registering an event.

> If a ``unique_id`` is given, the handler will not be registered
> if a handler with the ``unique_id`` has already been registered.


# Are these changes tested?

Basic unit test to assert the client passed is the client used.

# Are there any user-facing changes?

I believe so since this is an addition to the public API.
gabeiglio pushed a commit to Netflix/iceberg-python that referenced this pull request Aug 13, 2025
3 changes here...

1. Basically a mirror of
apache#1920 but for dynamo
2. Allow users to pass in an existing client/pass initialize client with
properties in `RestCatalog` with sigv4 enabled. (closes apache#2070, closes
apache#2008)
3. Re-use of the client in `add_headers` in `RestCatalog` with sigv4.
(closes apache#2069 )

---------

Co-authored-by: Marko Grujic <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support creating a GlueCatalog with own client.

4 participants