Skip to content

Instantly share code, notes, and snippets.

@JudahSan
Last active February 29, 2024 18:58
Show Gist options
  • Save JudahSan/ddfe902b5c2c6699b3012257c69c1be4 to your computer and use it in GitHub Desktop.
Save JudahSan/ddfe902b5c2c6699b3012257c69c1be4 to your computer and use it in GitHub Desktop.
What is DynamoDB� Is it a typo? This is an into to NoSQL- DynamoDB lab

3 - Create Tables

You will create 4 tables based on JSON format. For that, you will use the DynamoDBManager.create_table method.

To make it easy to access the properties of each of the tables, create the dictionaries that have the following attributes:

  • table_name: Name of the table, composed of a course prefix and the table name.
  • kwargs: Dictionary with additional arguments used in the DynamoDBManager.create_table method.

Let's take a closer look at the attributes inside the kwargs dictionary:

  • KeySchema: Specifies the attributes that make up the primary key for a table or an index. The attributes in KeySchema must also be defined in the AttributeDefinitions array. This consists of one or more pairs of attribute names and key types:
    • HASH - partition key. The partition key of an item is also known as its hash attribute. The term "hash attribute" derives from DynamoDB’s usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values.
    • RANGE - sort key. The sort key of an item is also known as its range attribute. The term "range attribute" derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.
    • The Partition and Sort keys should be defined according to the patterns to access the data. If there is no Sort key, the Partition Key must be unique. If there is a Sort key, the combination of Partition and Sort keys must be unique.
  • AttributeDefinitions: An array of attributes that describe the key schema for the table and indexes.
  • ProvisionedThroughput: The provisioned throughput settings for the global secondary index, consisting of read and write capacity units.

You can take a look at the create_table documentation.

Question: What is DynamoDB�

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment