1 00:00:00,150 --> 00:00:03,450 ‫So let's quickly talk about PartiQL for DynamoDB, 2 00:00:03,450 --> 00:00:05,840 ‫which allows you to use a SQL-like syntax 3 00:00:05,840 --> 00:00:07,880 ‫to manipulate DynamoDB tables. 4 00:00:07,880 --> 00:00:09,950 ‫So this is what the statements would look like. 5 00:00:09,950 --> 00:00:13,130 ‫And then from this, you can insert, for example, 6 00:00:13,130 --> 00:00:18,130 ‫or update or select or delete items from a DynamoDB table. 7 00:00:18,390 --> 00:00:21,340 ‫So, it's to allow people who are more confident to 8 00:00:21,340 --> 00:00:25,510 ‫use SQL to still be able to interact with DynamoDB. 9 00:00:25,510 --> 00:00:28,490 ‫And it also supports Batch operations, if you need to. 10 00:00:28,490 --> 00:00:31,840 ‫So let me show you how PartiQL works in the console. 11 00:00:31,840 --> 00:00:33,480 ‫So I am in my tables, 12 00:00:33,480 --> 00:00:36,320 ‫and the left hand side is the PartiQL editor. 13 00:00:36,320 --> 00:00:37,860 ‫So let's open some of these tables, 14 00:00:37,860 --> 00:00:41,460 ‫for example, let's open the user's table and I emptied it 15 00:00:41,460 --> 00:00:44,010 ‫but I can, for example, add an item real quick, 16 00:00:44,010 --> 00:00:48,380 ‫so I can have a user_id 123 as well as a new attribute, 17 00:00:48,380 --> 00:00:51,600 ‫name, Stephan, and this is good. 18 00:00:51,600 --> 00:00:54,640 ‫And for my other table, the user's post, 19 00:00:54,640 --> 00:00:56,940 ‫I can again, add some items, 20 00:00:56,940 --> 00:01:00,190 ‫so user_id 123 post_id 456 21 00:01:00,190 --> 00:01:03,680 ‫and create the item, as well as for the demo indexes, 22 00:01:03,680 --> 00:01:05,080 ‫I can create an item 23 00:01:05,080 --> 00:01:09,010 ‫user_id 123 game times stamp 2022, 24 00:01:09,010 --> 00:01:10,820 ‫even if it's not really good. 25 00:01:10,820 --> 00:01:14,150 ‫And then game_id 456. 26 00:01:14,150 --> 00:01:17,470 ‫Okay. So I have created some items into all my tables, 27 00:01:17,470 --> 00:01:20,410 ‫and now if you go to the PartiQL editor, we can look, 28 00:01:20,410 --> 00:01:24,120 ‫for example, at the user's table and I can delete this. 29 00:01:24,120 --> 00:01:26,460 ‫And I click on users and I do scan table 30 00:01:26,460 --> 00:01:28,170 ‫and it has a select start from users 31 00:01:28,170 --> 00:01:30,520 ‫which is a SQL statements. 32 00:01:30,520 --> 00:01:31,473 ‫And if I run it, 33 00:01:33,370 --> 00:01:36,003 ‫it says that the statement wasn't well formed. 34 00:01:37,870 --> 00:01:39,980 ‫So now it is completed and you can see 35 00:01:39,980 --> 00:01:44,100 ‫that the items result is defined and user_id 123 36 00:01:44,100 --> 00:01:46,740 ‫that we can also get in adjascent view, if you wanted to 37 00:01:46,740 --> 00:01:47,870 ‫because this is what would be used 38 00:01:47,870 --> 00:01:50,120 ‫in your code to deal with it. 39 00:01:50,120 --> 00:01:52,500 ‫And we can download the results to a CSV. 40 00:01:52,500 --> 00:01:53,870 ‫Next, for more complicated stuff, 41 00:01:53,870 --> 00:01:56,030 ‫you can look at the demo indexes table, 42 00:01:56,030 --> 00:01:57,760 ‫and we can scan this table again, 43 00:01:57,760 --> 00:02:00,990 ‫so we'll have the look at all the items. 44 00:02:00,990 --> 00:02:02,280 ‫But you can do more interesting stuff, 45 00:02:02,280 --> 00:02:04,660 ‫for example, you can query the table, 46 00:02:04,660 --> 00:02:07,580 ‫and when you query the table, it generates for you 47 00:02:07,580 --> 00:02:11,050 ‫a statement and it says, solid start from demo indexes, 48 00:02:11,050 --> 00:02:12,730 ‫where user_id equals, for example, 49 00:02:12,730 --> 00:02:15,880 ‫1,2,3, and then you can also have an end game 50 00:02:15,880 --> 00:02:19,060 ‫time stamp equals Sort key value, but this is optional. 51 00:02:19,060 --> 00:02:20,530 ‫And if you run this, obviously, 52 00:02:20,530 --> 00:02:23,060 ‫then we get the correct items. 53 00:02:23,060 --> 00:02:24,350 ‫And so we can start building some pretty 54 00:02:24,350 --> 00:02:29,350 ‫complicated queries, but because we have a index right here, 55 00:02:29,400 --> 00:02:31,980 ‫we can actually use this index and scan it. 56 00:02:31,980 --> 00:02:35,120 ‫So we can do select start from demo indexes 57 00:02:35,120 --> 00:02:36,350 ‫and then the name of the index. 58 00:02:36,350 --> 00:02:39,860 ‫And it's going to return the item based on my index. 59 00:02:39,860 --> 00:02:40,850 ‫And you can do many things, 60 00:02:40,850 --> 00:02:42,320 ‫you can run insert statements 61 00:02:42,320 --> 00:02:43,790 ‫although they're not easy to run directly 62 00:02:43,790 --> 00:02:46,680 ‫from the UI because they're not automatically generated. 63 00:02:46,680 --> 00:02:50,230 ‫You can also set an item, so you can update a specific item 64 00:02:50,230 --> 00:02:53,050 ‫and set the attribute value, the Partition key value 65 00:02:53,050 --> 00:02:55,030 ‫and the Sort key value and so on. 66 00:02:55,030 --> 00:02:56,530 ‫Or you can, for example, 67 00:02:56,530 --> 00:03:00,850 ‫drop a specific item and you have a delete from statement. 68 00:03:00,850 --> 00:03:03,730 ‫So this editor is just for people who want to use SQL 69 00:03:03,730 --> 00:03:05,010 ‫against DinamoDB. 70 00:03:05,010 --> 00:03:07,460 ‫And I just want to trigger the feature very briefly. 71 00:03:07,460 --> 00:03:08,480 ‫Okay. That's it. 72 00:03:08,480 --> 00:03:09,420 ‫I hope you liked it, 73 00:03:09,420 --> 00:03:11,370 ‫and I will see you in the next lecture.