Implement pre-existing session support for dynamodb catalog - #104
Conversation
|
Thanks @waifairer for raising this! Could you also update the docs under |
|
Done, thanks @Fokko |
HonahX
left a comment
There was a problem hiding this comment.
Thanks @waifairer for the contribution! It looks good to me! Just have one comment about adding a unit test for this.
| aws_secret_access_key=properties.get("aws_secret_access_key"), | ||
| aws_session_token=properties.get("aws_session_token"), | ||
| ) | ||
| self.dynamodb = session.client(DYNAMODB_CLIENT) |
There was a problem hiding this comment.
Shall we add a unit test for this update? Like this one in GlueCatalog's test:
iceberg-python/tests/catalog/test_glue.py
Lines 442 to 459 in d8bc9a9
There was a problem hiding this comment.
Hey @HonahX , thanks for the suggestion. I added the unit test as you requested.
| catalog: | ||
| default: | ||
| type: dynamodb | ||
| table-name: iceberg |
There was a problem hiding this comment.
Just noticed that we're mixing case here 😭
There was a problem hiding this comment.
oh yeah.. i mean the underscores are pretty typical aws syntax but iceberg has always used hyphens afaik
There was a problem hiding this comment.
I think we have an inconsistency since the FileIO configurations use hyphens for s3 credentials:
iceberg-python/mkdocs/docs/configuration.md
Lines 66 to 67 in d8bc9a9
Also, what about adding a dynamo. prefix to these credential keys?
dynamodb.access-key-id
dynamodb.secret-access-key
...
This could help clarify that these keys are used exclusively by the catalog, not the FileIO:
Just thinking ahead, if we're in favor of renaming these configurations, perhaps it's something we could roll out in a separate PR, especially considering updates to the GlueCatalog configurations that would follow.
I'd love to hear your thoughts on this.
There was a problem hiding this comment.
@HonahX Definitely agreed with dynamo as a prefix.
As for hyphens vs underscores, AWS is really consistent about using underscores. I'm of the opinion that the AWS-based credentials should support both underscores and hyphens, will prefer hyphens if present, but fall back to the underscore usages if necessary. Documentation should only present the hyphenated case as an option. I believe that this strategy would lead to the least number of "head banging" debug sessions. However, I think a reasonable case could be made to remove underscore support instead of supporting it as a fallback.
There was a problem hiding this comment.
@waifairer Yes, I totally agree. Let's do that in a separate PR.
| except self.dynamodb.exceptions.InternalServerError as e: | ||
| raise GenericDynamoDbError(e.message) from e | ||
|
|
||
| print(response["Table"]["TableStatus"]) |
There was a problem hiding this comment.
Nit: could you please remove this print?
There was a problem hiding this comment.
Not a nit at all, thanks for the catch
| aws_secret_access_key=properties.get("aws_secret_access_key"), | ||
| aws_session_token=properties.get("aws_session_token"), | ||
| ) | ||
| self.dynamodb = session.client(DYNAMODB_CLIENT) |
HonahX
left a comment
There was a problem hiding this comment.
LGTM! Just adding some thoughts on the configuration naming
| catalog: | ||
| default: | ||
| type: dynamodb | ||
| table-name: iceberg |
There was a problem hiding this comment.
I think we have an inconsistency since the FileIO configurations use hyphens for s3 credentials:
iceberg-python/mkdocs/docs/configuration.md
Lines 66 to 67 in d8bc9a9
Also, what about adding a dynamo. prefix to these credential keys?
dynamodb.access-key-id
dynamodb.secret-access-key
...
This could help clarify that these keys are used exclusively by the catalog, not the FileIO:
Just thinking ahead, if we're in favor of renaming these configurations, perhaps it's something we could roll out in a separate PR, especially considering updates to the GlueCatalog configurations that would follow.
I'd love to hear your thoughts on this.
Fokko
left a comment
There was a problem hiding this comment.
Sorry for the long wait @waifairer LGTM 🙌 Thanks for working on this, and @HonahX thanks for the review
| catalog: | ||
| default: | ||
| type: dynamodb | ||
| table-name: iceberg |
There was a problem hiding this comment.
@waifairer Yes, I totally agree. Let's do that in a separate PR.
Looks like Dynamo is lacking some properties which are documented for other AWS-centric catalog types.