1
00:00:01,440 --> 00:00:07,280
In the last lecture we created our first table using the AWOS gone.

2
00:00:07,290 --> 00:00:11,550
So let's look at some item level operations in this video.

3
00:00:15,040 --> 00:00:25,150
If you work with relational databases before you may have noticed that we did not specify the names

4
00:00:25,150 --> 00:00:29,910
of all the columns are all the item attributes.

5
00:00:30,010 --> 00:00:38,730
This is because unlike relational databases dynamo DBI does not enforce strict schema.

6
00:00:41,040 --> 00:00:50,370
Only the primary key attributes are mandatory and all other attributes including the ones that are used

7
00:00:50,430 --> 00:00:53,830
in the secondary access are optional.

8
00:00:53,980 --> 00:01:01,680
So one item in Dynamo table could have two attributes right and another atom in the same table could

9
00:01:01,680 --> 00:01:09,810
have 10 attributes for example and both would still be valid items as long as they have the primary

10
00:01:09,810 --> 00:01:17,280
key attributes included if any item does not have a value for a secondary index key.

11
00:01:17,310 --> 00:01:23,570
It will simply be excluded from that particular index and will see this in action.

12
00:01:23,580 --> 00:01:24,290
In this video

13
00:01:27,360 --> 00:01:31,060
let's add some data to our lives table.

14
00:01:32,280 --> 00:01:34,850
Click on the items tab.

15
00:01:35,790 --> 00:01:38,910
Click on the Create item button to add data.

16
00:01:43,720 --> 00:01:52,640
We can simply free let the keys and values here and we can use the plus sign on the left to insert apin

17
00:01:52,700 --> 00:02:02,300
or remove an atom insert as an attribute about the current attribute Aben as set after the current attribute

18
00:02:02,570 --> 00:02:07,910
and the Remove will simply remove IDE tribute from the.

19
00:02:08,160 --> 00:02:17,910
If you prefer the Chaisson format you can switch from tree to text and you can edit or pasting some

20
00:02:17,910 --> 00:02:18,980
Jason here.

21
00:02:20,570 --> 00:02:29,690
If you use dynamo DBI Jason checkbox you'll see that Dynamo the beacon works these days and into its

22
00:02:29,780 --> 00:02:41,450
own internal format which includes the data type as the search string is denoted by an uppercase s number

23
00:02:41,450 --> 00:02:49,270
by an upper case n binary by uppercase B and so on set.

24
00:02:49,400 --> 00:02:51,750
Let's add some dummy data.

25
00:02:59,060 --> 00:03:00,330
For a user ID.

26
00:03:00,330 --> 00:03:07,120
I'm just rolling some keys on my keyboard to get some random value.

27
00:03:07,140 --> 00:03:09,060
Same for no tidy

28
00:03:18,520 --> 00:03:19,730
four times.

29
00:03:19,770 --> 00:03:29,760
Dan let's grab the current epoch times down around Unix time stamp dot com and it

30
00:03:59,510 --> 00:04:07,550
and then we also want to add a content attribute to hold the main text of our no

31
00:04:16,330 --> 00:04:28,510
click on Save to save the item and we have one item you can edit the non-key it to be is in line using

32
00:04:28,510 --> 00:04:29,610
the pencil.

33
00:04:29,650 --> 00:04:40,980
I can hear or simply click on the blue hyperlink to edit it in the editor action Stabb has options like

34
00:04:40,980 --> 00:04:46,270
duplicate item added deleted exported to CSB.

35
00:04:46,290 --> 00:04:53,690
And these are pretty much exactly do what they say manage.

36
00:04:53,690 --> 00:05:00,710
TTL is something will cower in the later part of the course.

37
00:05:00,890 --> 00:05:09,150
So I'm going to use the duplicate option to add some more dummy data here.

38
00:05:09,950 --> 00:05:17,360
And we just have to provide a new primary key values and maybe change some other attributes if we like

39
00:05:33,850 --> 00:05:36,450
and we should have a couple of items.

40
00:05:39,180 --> 00:05:47,180
Now I'm going to duplicate an item and this time I'm going to drop the note ID attribute

41
00:05:58,100 --> 00:06:07,550
and one item where I'll drop the category attribute.

42
00:06:08,220 --> 00:06:15,280
Now if you notice these attributes are part of the global and local.

43
00:06:15,300 --> 00:06:16,910
Second the next keywords.

44
00:06:16,930 --> 00:06:26,780
So if we don't get them from any item that particular item will be omitted from the corresponding index.

45
00:06:26,830 --> 00:06:30,800
Let me show you what I am from the dropdown.

46
00:06:30,910 --> 00:06:34,540
Let's select the note Id index.

47
00:06:34,540 --> 00:06:38,520
This is our global secondary index right.

48
00:06:38,600 --> 00:06:49,690
Note ID has the partition key take Star Search and you'll notice that the item with the note id attribute

49
00:06:49,810 --> 00:06:51,750
is not showing up here.

50
00:06:52,030 --> 00:07:00,100
Similarly if we select our local secondary next that has category as the sarky.

51
00:07:00,140 --> 00:07:06,120
You'll notice that the item with no category is not part of this index.

52
00:07:07,640 --> 00:07:15,730
Now let's get back to the primary index are the table index and hit search.

53
00:07:15,960 --> 00:07:19,660
And here we see old items in our table

54
00:07:25,200 --> 00:07:31,590
if we add more columns are more attributes to the items.

55
00:07:31,590 --> 00:07:41,490
The display sometimes gets slightly cluttered so we get hide or show the design columns using the gear

56
00:07:41,570 --> 00:07:44,250
icon on the top right here.

57
00:07:52,850 --> 00:07:57,290
Now let's look at how to blow from reeds.

58
00:07:57,290 --> 00:07:58,770
There are two ways.

59
00:07:59,000 --> 00:08:10,000
Query and can let's select query first we have to specify the index to be used.

60
00:08:10,070 --> 00:08:20,340
We can query using that table index are the primary key or any of the secondary indexes that we created.

61
00:08:20,690 --> 00:08:31,390
Let's use the table index with the operations you must specify the partition key value.

62
00:08:31,390 --> 00:08:38,450
We have to specify the entire partition key and sarky is optional.

63
00:08:38,890 --> 00:08:49,290
In other words what this also means is query operation performs a search within a single partition.

64
00:08:50,170 --> 00:08:55,030
If I say user ID equals this and search

65
00:08:59,210 --> 00:09:01,580
Rishabh see all the matching items.

66
00:09:01,580 --> 00:09:10,090
And since they all have the same partition key they will be stored in the same partition.

67
00:09:10,460 --> 00:09:20,540
By default These will be sorted by the sarky of the selected index and we can switch the sort order

68
00:09:20,630 --> 00:09:22,050
using the sort.

69
00:09:22,060 --> 00:09:23,210
The radio button here

70
00:09:30,610 --> 00:09:36,020
we can also specify as sarky to narrow down our search.

71
00:09:36,310 --> 00:09:40,500
We can't specify sarky in different ways.

72
00:09:40,630 --> 00:09:48,280
For example we can use combatives and operators equal to greater than between and so on.

73
00:09:48,280 --> 00:09:56,210
Similarly if our key is strong for example let's select the category index.

74
00:09:56,220 --> 00:10:03,140
So with string based sarky we have one more option begins with.

75
00:10:03,380 --> 00:10:12,400
So these are different ways we can narrow down our search and mission or we could also specify a filter

76
00:10:12,400 --> 00:10:18,550
or criteria filter criteria as typically is to filter our data.

77
00:10:18,570 --> 00:10:25,220
What conditions are conditions on non-key attributes.

78
00:10:25,860 --> 00:10:36,270
An important thing to remember here is filters are always filters are always applied after performing

79
00:10:36,270 --> 00:10:37,770
the query.

80
00:10:38,070 --> 00:10:47,610
Dynamo divi performs the raid using the specified index criteria and once it has retrieved the data

81
00:10:47,700 --> 00:10:56,410
it filters set according to the filter criteria provided before returning the data to us.

82
00:10:56,460 --> 00:11:06,540
What this means is specifying one or more filters will not affect they are consumed by the particular

83
00:11:06,540 --> 00:11:07,890
read operation.

84
00:11:08,040 --> 00:11:15,250
You still can zoom the same number of hours to use whether you use a filter or you don't.

85
00:11:15,260 --> 00:11:19,170
So filter is just a convenience feature.

86
00:11:19,170 --> 00:11:22,920
So to say let's look at this.

87
00:11:22,920 --> 00:11:29,600
Can operation select scan from the drop down and hit search.

88
00:11:29,650 --> 00:11:33,250
So we select an index and hit search.

89
00:11:33,490 --> 00:11:36,960
And we should see the corresponding data

90
00:11:39,980 --> 00:11:47,560
and since we selected the table index we'll see all the items in the table up to 100 added time

91
00:11:50,480 --> 00:11:58,280
unlike Curti which provides us data from the partitions specified by the partition key scan operation

92
00:11:58,280 --> 00:12:05,970
can provide us data across partitions and just like operations.

93
00:12:05,990 --> 00:12:11,700
We can also specify filters in the same way for our scanner operations as well.

94
00:12:14,790 --> 00:12:23,600
And again the filters get applied only after performing these can serve dynamo IDB performs the read

95
00:12:23,610 --> 00:12:32,100
first and once it has retrieved the data it filters said according to the filter criteria that is specified

96
00:12:32,460 --> 00:12:42,480
before it returns the data to us and since scanner operations perform so chairs across the table partitions

97
00:12:42,510 --> 00:12:47,250
they can use the read capacity and it's very very fast.

98
00:12:47,280 --> 00:12:54,160
And that is the reason we should avoid using scan operations as far as possible.

99
00:12:54,300 --> 00:12:57,970
And Bradford the cruddy operations for our purposes

100
00:13:01,130 --> 00:13:02,690
this is the reason why.

101
00:13:02,730 --> 00:13:13,760
Well our data modeling is very crucial when working with Dynamo D-B we should choose table keys and

102
00:13:13,790 --> 00:13:24,380
indexes ready carefully considering all the different possibilities of the operations that our application

103
00:13:24,380 --> 00:13:29,150
might need to perform now as well as in future.

104
00:13:29,390 --> 00:13:39,020
So we must think ahead of time and also consider any possible future use cases.

105
00:13:39,020 --> 00:13:46,760
So we are not forced to recreate the whole table if any is case arises in future.

106
00:13:50,200 --> 00:13:56,670
That's more or less all about the item level operations in Dannemora maybe in the next lecture.

107
00:13:56,710 --> 00:14:07,150
I'll walk you through the different options we have on these tabs on the dynamo or the console so.

108
00:14:07,330 --> 00:14:13,510
Thank you for your time and I'll see you in the next Vidia in just a few moments.
