Skip to content
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

feat: Model Attribute Transformation #1201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

neilramsay
Copy link

PynamoDB sometimes need to connect to a DynamoDB Table that is not managed by PynamoDB, and may have different naming conventions, such as Camel Case (which is used by JSON).

PynamoDB can be configured to override individual attribute names, however in practice every attribute needs to be overridden to map between naming conventions.

This commit introduces a Model Attribute Transformation, which effectively converts python snake case to another naming convention without overriding every attribute.
This is an opt-in feature, and does not cause any breaking change to existing functionality.

@neilramsay
Copy link
Author

neilramsay commented Oct 25, 2023

Please note:

  • I have not built the documentation, so there may need to be some formatting updates
  • I'm not 100% clear on how to format the type hints for long function definitions (and have avoided using my inbuilt 'black' formatter).

PynamoDB sometimes need to connect to a
DynamoDB Table that is not managed by PynamoDB, and may have different
naming conventions, such as Camel Case (which is used by JSON).

PynamoDB can be configured to override individual attribute names,
however in practice every attribute needs to be overridden
to map between naming conventions.

This commit introduces a Model Attribute Transformation, which
effectively converts python snake case to another naming convention
without overriding every attribute.
This is an opt-in feature, and does not cause any breaking change
to existing functionality.
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.

None yet

1 participant