0

I want to create a table in dynamodb using data model / entity classes. Is there any way to do in the way?

I have searched for the examples of table creation using entity classes but no results found

If you have any demo solutions or any documentation, please provide

  • Does this documentation help? https://docs.aws.amazon.com/sdk-for-net/v2/developer-guide/dynamodb-intro.html#dynamodb-intro-apis-object-persistence – Joe Aug 25 '19 at 13:06
  • Hi Joe, I have gone through this documentation; Here they provided to save or load the data in already created tables. There is no mentioning of creation of table – Raghavendra prasad Aug 25 '19 at 14:00
  • There's nothing out of the box. You could write code to read attributes such as DynamoDBTable, DynamoDBHashKey from your models and call the AWS API - but the model won't generally contain all the information you need to create the table - e.g. Provisioned throughput. – Joe Aug 25 '19 at 15:51
  • Note also that you will often want different table names for Development and Production environments: any code that creates the table will therefore need to know what prefix to prepend to the table name you retrieve from the DynamoDBTable attribute: https://aws.amazon.com/blogs/developer/configuring-dynamodb-tables-for-development-and-production/. – Joe Aug 26 '19 at 06:11
  • Sure, will follow the suggestion you have given, @Joe – Raghavendra prasad Aug 26 '19 at 09:51

1 Answers1

0

For creating table based on models, there are two steps.

First, you need to get the table name, AttributeDefinition and KeySchemaElement from entity, for this, you could try reflection to get the entity attibute and properties like Reflection - get attribute name and value on property.

Second, you could try create table based on above information like Step 2: Create a Table Using the Low-Level API

Edward
  • 28,296
  • 11
  • 76
  • 121