1
00:00:00,270 --> 00:00:05,750
In this video, we are going to be writing an item into the IMDB table.

2
00:00:05,760 --> 00:00:13,530
So we are in the use case three red and white item in the table and we will use put item command in

3
00:00:13,530 --> 00:00:16,380
order to writing item in the existing table.

4
00:00:16,590 --> 00:00:22,500
So before we start, we should check the API SDK reference documentation.

5
00:00:22,500 --> 00:00:28,410
So in here I'm going to search for the food item command, food item command.

6
00:00:28,980 --> 00:00:34,110
If you click the food item command, you can see the details, how we can insert an item into Dynamo

7
00:00:34,170 --> 00:00:38,580
DB table, we can see example usage code in here.

8
00:00:38,580 --> 00:00:41,850
We should import IMDB client and put item command.

9
00:00:41,850 --> 00:00:45,000
So put item command, get some input parameters.

10
00:00:45,000 --> 00:00:49,500
In order to see the parameters, we can click the output item command input.

11
00:00:50,130 --> 00:00:56,070
If you see the put item command properties, you can see there's lots of properties that we can provide.

12
00:00:56,070 --> 00:01:02,190
So the table name is important, we should provide the table name and after that we should add an item

13
00:01:02,190 --> 00:01:03,060
in here.

14
00:01:03,060 --> 00:01:06,510
So item will be insert or dynamic DB table.

15
00:01:06,510 --> 00:01:13,290
If you open the item, you can see the structure of the item, how we can provide these properties into

16
00:01:13,290 --> 00:01:13,980
an item.

17
00:01:13,980 --> 00:01:17,580
So let's implement this code in our visit to the code project.

18
00:01:17,610 --> 00:01:20,460
In order to do that, please open the visual code.

19
00:01:20,460 --> 00:01:26,520
And as you know that I'm going to follow the same folder, which is the all CRUD operations.

20
00:01:26,520 --> 00:01:32,910
So now I have created a new JavaScript file, which is the right item that is in this file.

21
00:01:32,910 --> 00:01:39,170
Basically, we will implement our actual logic to interact the Dynamo DB For that purpose, I have created

22
00:01:39,170 --> 00:01:43,800
a run function and and we call these function in the same file.

23
00:01:43,800 --> 00:01:49,920
And after that we have prepared the parameters to pasting the dynamic DB client object.

24
00:01:49,920 --> 00:01:52,410
And also we need to import statement as well.

25
00:01:52,500 --> 00:01:55,110
So let's start implementation.

26
00:01:55,110 --> 00:02:01,080
Basically, I'm going to write this line of code to perform put data operation.

27
00:02:01,170 --> 00:02:04,560
So if you remove the command part.

28
00:02:04,560 --> 00:02:09,300
So basically as you can see that this time we are using to put item command with sending the Dynamo

29
00:02:09,300 --> 00:02:10,050
DB client.

30
00:02:10,050 --> 00:02:15,990
So we need to import put item command statement into our HDC packets.

31
00:02:15,990 --> 00:02:23,700
So last thing is left for the parameters, how we can add parameters and create items into Dynamo DB

32
00:02:23,730 --> 00:02:27,750
using the boot item command, we should provide the parameters in here.

33
00:02:27,750 --> 00:02:33,150
So basically there are two main parameters when creating an item.

34
00:02:33,600 --> 00:02:36,390
This is the table name and the item parameters.

35
00:02:36,390 --> 00:02:42,390
So a table name is a product that we create in the last video, an item that is going to insert item

36
00:02:42,390 --> 00:02:44,100
into our dynamic DB table.

37
00:02:44,130 --> 00:02:49,530
We should provide the partition key, which is the ID and specify the number format.

38
00:02:49,530 --> 00:02:55,500
And after that I have several attributes that you can add additional attributes in this line of code.

39
00:02:55,500 --> 00:03:02,820
I'm going to add a name and the name is a string and I'm going to add the iPhone X product into number

40
00:03:02,820 --> 00:03:03,870
001.

41
00:03:03,870 --> 00:03:10,920
So here you can find the parameters and this parameter definition to the boot item command and dynamically

42
00:03:10,920 --> 00:03:15,870
be client object sent to our item command to dynamic DB to insert an item.

43
00:03:15,990 --> 00:03:23,640
So please save this file and open the terminal, go to the same directory and run the node command for

44
00:03:23,640 --> 00:03:27,150
the writing and item so not v.

45
00:03:27,150 --> 00:03:29,670
We are going to run node command with the right item.

46
00:03:29,670 --> 00:03:31,410
JS Hit the enter.

47
00:03:32,630 --> 00:03:37,090
So you can see that we have successfully get a 200 response.

48
00:03:37,100 --> 00:03:42,500
That means we have added in inserted successfully item into dynamic TV.

49
00:03:42,530 --> 00:03:44,810
To verify that, please open the.

50
00:03:46,170 --> 00:03:47,410
Edwards management console.

51
00:03:47,430 --> 00:03:48,750
Go to product table.

52
00:03:48,900 --> 00:03:50,660
Click to explore table items.

53
00:03:50,670 --> 00:03:57,600
Run the scan command and see that we have successfully ad ID one and the name is a phone x.

54
00:03:58,370 --> 00:04:06,500
Since we have defined as a number even we give the 001, it takes the one to the ID as a part of product

55
00:04:06,500 --> 00:04:07,040
table.

56
00:04:07,340 --> 00:04:12,290
So as you can see that we have successfully write item in order in the table.

57
00:04:12,320 --> 00:04:15,340
In the next video we are going to read data from this table.
