Created
December 10, 2023 05:30
-
-
Save kkmtyyz/f934e8a9f617a29de6503ffef1b88018 to your computer and use it in GitHub Desktop.
put_item_into_dynamodb_information_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
session = boto3.Session(profile_name="my_profile") | |
client = session.client("dynamodb") | |
res = client.put_item( | |
TableName="information", | |
Item={ | |
"id": {"N": "1"}, | |
"work_id": {"S": "work_01"}, | |
"work_date": {"S": "2023-12-10"}, | |
"work_location": {"S": "C県D市"}, | |
"user_id": {"S": "user_01"}, | |
"birth_date": {"S": "1993-01-01"}, | |
"sleeping_hours": {"N": "8"}, | |
"has_breakfast": {"BOOL": True}, | |
"10_operation": {"S": "A"}, | |
"11_operation": {"S": "B"}, | |
"12_operation": {"S": "B"}, | |
"10_hydration": {"BOOL": True}, | |
"11_hydration": {"BOOL": False}, | |
"12_hydration": {"BOOL": True}, | |
}, | |
) | |
res = client.put_item( | |
TableName="information", | |
Item={ | |
"id": {"N": "2"}, | |
"work_id": {"S": "work_02"}, | |
"work_date": {"S": "2024-01-01"}, | |
"work_location": {"S": "A県B市"}, | |
"user_id": {"S": "user_01"}, | |
"birth_date": {"S": "1993-01-01"}, | |
"sleeping_hours": {"N": "6"}, | |
"has_breakfast": {"BOOL": False}, | |
"10_operation": {"S": "B"}, | |
"11_operation": {"S": "B"}, | |
"12_operation": {"S": "B"}, | |
"10_hydration": {"BOOL": False}, | |
"11_hydration": {"BOOL": False}, | |
"12_hydration": {"BOOL": False}, | |
}, | |
) | |
res = client.put_item( | |
TableName="information", | |
Item={ | |
"id": {"N": "3"}, | |
"work_id": {"S": "work_03"}, | |
"work_date": {"S": "2024-02-01"}, | |
"work_location": {"S": "E県F市"}, | |
"user_id": {"S": "user_01"}, | |
"birth_date": {"S": "1993-01-01"}, | |
"sleeping_hours": {"N": "8"}, | |
"has_breakfast": {"BOOL": True}, | |
"10_operation": {"S": "B"}, | |
"11_operation": {"S": "B"}, | |
"12_operation": {"S": "C"}, | |
"10_hydration": {"BOOL": False}, | |
"11_hydration": {"BOOL": False}, | |
"12_hydration": {"BOOL": True}, | |
}, | |
) | |
res = client.put_item( | |
TableName="information", | |
Item={ | |
"id": {"N": "4"}, | |
"work_id": {"S": "work_04"}, | |
"work_date": {"S": "2023-12-10"}, | |
"work_location": {"S": "A県B市"}, | |
"user_id": {"S": "user_02"}, | |
"birth_date": {"S": "1988-01-01"}, | |
"sleeping_hours": {"N": "6"}, | |
"has_breakfast": {"BOOL": True}, | |
"10_operation": {"S": "B"}, | |
"11_operation": {"S": "B"}, | |
"12_operation": {"S": "B"}, | |
"10_hydration": {"BOOL": False}, | |
"11_hydration": {"BOOL": True}, | |
"12_hydration": {"BOOL": False}, | |
}, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment