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

fix: Improve handling of primary keys with property converters with DisableFetchingTableMetadata #3327

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

ashovlin
Copy link
Member

@ashovlin ashovlin commented May 31, 2024

Description

When using DisableFetchingTableMetadata in the object-persistence programming model, the SDK infers its understanding of a DynamoDB table and/or index's key structure based on the attributed data model, as opposed to calling DescribeTable to load the actual table/index configuration.

The data type of primary keys is expected to be one of our DynamoDBEntryType and can be represented by a Primitive.

public enum DynamoDBEntryType {
/// <summary>
/// DynamoDB String type.
/// </summary>
String,
/// <summary>
/// DynamoDB Numeric type.
/// </summary>
Numeric,
/// <summary>
/// DynamoDB Binary type.
/// </summary>
Binary
}

The SDK was throwing an exception for the case when:

  1. A property converter is applied to an attribute that is part of a key
  2. That property converter returns an UnconvertedDynamoDBEntry (as opposed to a Primitive directly)

Now, if a property converter returns an UnconvertedDynamoDBEntry for a property used in a key, the SDK will attempt to convert it again towards a Primitive. If it still cannot, I clarified the exception that is thrown.

Motivation and Context

DOTNET-7524 -> #3323

Testing

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

License

  • I confirm that this pull request can be released under the Apache 2 license

…sing the object-persistence programming model with DisableFetchingTableMetadata
@ashovlin ashovlin changed the base branch from main to main-staging May 31, 2024 19:20
@ashovlin ashovlin merged commit 4bbe667 into main-staging Jun 3, 2024
3 of 4 checks passed
@ashovlin ashovlin deleted the shovlia/key-converter branch June 3, 2024 16:28
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.

3 participants