Deploying a PostgreSQL database on Heroku (Part 2)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
2 of the postgres heroku tutorial where we left off was we were able to create the database and create the schema for the database of our project right so let's go ahead and go back to our terminal as we can see we have two tables in which there are there is nothing in either table so let's go ahead and try to persist some data so let's begin with the trainer we're going to go ahead and insert into the trainer table and the trainer had an id a name and the number of badges so let's give it some random values for example maybe one two three four maybe the trainer's name is andy like me and he might have seven badges so let me insert and we do the select again we'll see that it's in the database now when we come back here let's open this here we can actually observe the data clip like we had earlier so in this data clip let me open it in a new tab so i can keep the credentials open in the data clip for example let's say i want to select from trainer and i can see that my trainer is indeed here now if i try to create something in here it won't let me right so let me copy this here and this one so as you guys can see we can do read-only transactions inside of this thing now it's not always convenient to be typing things into the terminal right so what we're going to do is i want you guys to head on over to google and type in uh data grip all right so data grip is basically an id for databases sql that kind of stuff so let's go ahead here and download this and you'll select the appropriate version depending on the operating system that you're running and once we download this um you know i've already downloaded it so i'm not going to go ahead and do that we're going to head on over now to jetbrains education because this software um only gives you a 30 day license but with the uni on this email you can apply for the educational license right and you can type in here whatever email address you have at edu and it'll confirm the subscription for an educational license all right now once we open up data grip the first time you open it it's going to ask you to provide your login credentials and once you do that um you'll be set you'll be able to use data grip using the professional educational license that way you don't have to use it for only 30 days as you can see in my case it's registered to me and it's active until march 10th so this is really good so what we're going to do is we're going to hit new we'll hit data source we'll click postgres and we'll go back to our credentials tab all right first thing we'll do is copy the host information which will um put go back to this we're gonna put over here and then we'll find our user name which will go here the password and then the database name all right guys so once we have all of this we're going to hit test connection and we'll wait for it to give us a success message there we go this is checked so we'll hit apply and then we'll hit okay so back in data grip we'll see that um we'll have a new connection here with our database and if we come in here i can see our schema which is there we have our schema which is this pokemon we also have the schema for trainer there we go and we can see the different constraints and the public key private key all of that information all right so now let's go ahead and take a look at a at the console so uh i've already prepared uh a script that i'm just going to copy and paste and what this is going to do is it's going to create some trainers so let's take a look we're going to create four trainers ash don lyra and brendan which are the traditional uh trainers from generation one four two and three if i'm not mistaken and we're going to give pokemon to each of them so ash's id these are going to be ash's pokemon these are going to be don's pokemon lyras and what's his name brendan starting from here alright so let's go ahead now and execute all of this so it's inserting the values as we expect let's wait for that to finish all right looks like it's done so what we can do is we can either leave this console there or we can just eliminate the console and type something else in so now let's try to play around with some queries maybe i could say select all from pokemon run this and here we have our pokemon and the trainers all right now maybe we can try doing something else maybe we can say um select from pokemon let's put this here and maybe we can say where trainer equals 78127 which was ash's id and there we'll see ash's pokemon all right now you guys can play around with this sql but the important part is that now we can see these trainers and these pokemon and if we come back here if we'd like and i test the database one more time i can try to obtain all the pokemon we'll see that this is running and it's on the internet it's data stored in the cloud all right now we can come here we can see the data which should take us to the same thing let's go back to this example and now we see that we have one of 10 000 and there's four connections right to this thing so let's go ahead and come back to the data clip all right well while it loads let's open this data clip again and if i come here i can see the schema and we can save these different uh queries however i just wanted to show you guys that the information is all here all right if i select here from trainer save and run we'll see that our trainers are indeed there in addition to the one i created via the terminal all right so that's pretty much it guys um i can even select it here as well if i want to see select from a pokemon and i see them here as well all right so that was just a very basic introduction to how to set up a database from postgres onto the heroku platform so in the following videos to come i'll be delving a little bit deeper into the sql syntax all right well that's everything for today
Info
Channel: CodeHive
Views: 2,977
Rating: undefined out of 5
Keywords:
Id: lmMFQMcWbq0
Channel Id: undefined
Length: 8min 27sec (507 seconds)
Published: Fri Mar 12 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.