Usage of same property as DynamoDBRangeKey and DynamoDBGlobalSecondaryIndexHashKey #3232
-
Greetings to AWS community, In our project DynamoDb table is configured (cf below) in such a way that one of the properties (e.g. TransactionId) is defined as both
The table was successfully created and both Queries (via partition primary key and GSI) are available and working as expected via UI and in our solution written in .NET using AWSSDK.DynamoDBv2. Meanwhile, in the appropriate DynamoModel described in our code (code below) there is no DynamoDBRangeKey annotation applied to "TransactionId" property, and only DynamoDBGlobalSecondaryIndexHashKey is applied. So the question is why it is working and allows us to call both methods:
DynamoDb Cf
DynamoDbModel class
Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You didn't share how you created the
This extra call allows your application to work even if you didn't specify the |
Beta Was this translation helpful? Give feedback.
You didn't share how you created the
AmazonDynamoDBClient
andDynamoDBContext
, but by default the SDK will call the DescribeTable API prior to executing the query in order to:This extra call allows your application to work even if you didn't specify the
DynamoDBRangeKey
attribute, but it also has a performance impact; see this blog post for more details: https://aws.amazon.com/blogs/developer/improved-dynamodb-initialization-patterns-for-the-aws-sdk-for-net/