Project 03 - Jobtracker CLI - Adding Database

Building Command Line Tools with Python, Julia and Nodejs Module 05 - Building CLI Tools - Projects
22 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€65.51
List Price:  €93.59
You save:  €28.07
£56.31
List Price:  £80.45
You save:  £24.13
CA$95.76
List Price:  CA$136.81
You save:  CA$41.04
A$107.69
List Price:  A$153.85
You save:  A$46.15
S$95.27
List Price:  S$136.10
You save:  S$40.83
HK$548.21
List Price:  HK$783.19
You save:  HK$234.98
CHF 63.99
List Price:  CHF 91.41
You save:  CHF 27.42
NOK kr766.70
List Price:  NOK kr1,095.33
You save:  NOK kr328.63
DKK kr488.53
List Price:  DKK kr697.93
You save:  DKK kr209.40
NZ$117.93
List Price:  NZ$168.49
You save:  NZ$50.55
د.إ257.06
List Price:  د.إ367.25
You save:  د.إ110.18
৳7,672.34
List Price:  ৳10,960.96
You save:  ৳3,288.61
₹5,831.54
List Price:  ₹8,331.14
You save:  ₹2,499.59
RM334.37
List Price:  RM477.70
You save:  RM143.32
₦88,222.39
List Price:  ₦126,037.39
You save:  ₦37,815
₨19,408.82
List Price:  ₨27,728.08
You save:  ₨8,319.25
฿2,591.14
List Price:  ฿3,701.79
You save:  ฿1,110.65
₺2,276.07
List Price:  ₺3,251.67
You save:  ₺975.60
B$359.20
List Price:  B$513.17
You save:  B$153.96
R1,339.40
List Price:  R1,913.51
You save:  R574.11
Лв128.12
List Price:  Лв183.04
You save:  Лв54.91
₩96,245.98
List Price:  ₩137,500.16
You save:  ₩41,254.17
₪263.24
List Price:  ₪376.08
You save:  ₪112.83
₱4,030.89
List Price:  ₱5,758.67
You save:  ₱1,727.77
¥10,844
List Price:  ¥15,492.10
You save:  ¥4,648.09
MX$1,188.01
List Price:  MX$1,697.24
You save:  MX$509.22
QR253.94
List Price:  QR362.79
You save:  QR108.84
P970.94
List Price:  P1,387.12
You save:  P416.17
KSh9,413.65
List Price:  KSh13,448.65
You save:  KSh4,035
E£3,350.77
List Price:  E£4,787.02
You save:  E£1,436.25
ብር3,964.81
List Price:  ብር5,664.26
You save:  ብር1,699.44
Kz58,437.56
List Price:  Kz83,485.81
You save:  Kz25,048.25
CLP$66,749.46
List Price:  CLP$95,360.46
You save:  CLP$28,611
CN¥507.15
List Price:  CN¥724.53
You save:  CN¥217.38
RD$4,131.55
List Price:  RD$5,902.47
You save:  RD$1,770.91
DA9,407.33
List Price:  DA13,439.62
You save:  DA4,032.28
FJ$160.49
List Price:  FJ$229.29
You save:  FJ$68.79
Q543.50
List Price:  Q776.47
You save:  Q232.96
GY$14,625.47
List Price:  GY$20,894.43
You save:  GY$6,268.95
ISK kr9,845.49
List Price:  ISK kr14,065.59
You save:  ISK kr4,220.10
DH706.45
List Price:  DH1,009.26
You save:  DH302.80
L1,245.82
List Price:  L1,779.82
You save:  L534
ден4,030.78
List Price:  ден5,758.50
You save:  ден1,727.72
MOP$564.26
List Price:  MOP$806.12
You save:  MOP$241.86
N$1,339.20
List Price:  N$1,913.23
You save:  N$574.02
C$2,563.14
List Price:  C$3,661.78
You save:  C$1,098.64
रु9,324.38
List Price:  रु13,321.12
You save:  रु3,996.73
S/257.63
List Price:  S/368.06
You save:  S/110.42
K264.67
List Price:  K378.12
You save:  K113.45
SAR262.51
List Price:  SAR375.03
You save:  SAR112.52
ZK1,801.79
List Price:  ZK2,574.10
You save:  ZK772.30
L325.94
List Price:  L465.65
You save:  L139.71
Kč1,653.47
List Price:  Kč2,362.20
You save:  Kč708.73
Ft25,766.18
List Price:  Ft36,810.41
You save:  Ft11,044.22
SEK kr760.51
List Price:  SEK kr1,086.49
You save:  SEK kr325.98
ARS$61,084.05
List Price:  ARS$87,266.68
You save:  ARS$26,182.62
Bs481.20
List Price:  Bs687.45
You save:  Bs206.25
COP$273,176.37
List Price:  COP$390,268.69
You save:  COP$117,092.31
₡35,080.64
List Price:  ₡50,117.34
You save:  ₡15,036.70
L1,718.72
List Price:  L2,455.43
You save:  L736.70
₲516,687.24
List Price:  ₲738,156.27
You save:  ₲221,469.03
$U2,685.15
List Price:  $U3,836.09
You save:  $U1,150.94
zł283.11
List Price:  zł404.46
You save:  zł121.35
Already have an account? Log In

Transcript

All right, so welcome back again. So in this particular session of the project, we try to see how to connect our CI to a database in which you can store the data that you're receiving from our so often the user right, so let's see how to create it. So first of all, is going to be for our database option to be using SQL lite, which is very simple to input, I use MongoDB you can use graph qL, any format of W that you want to use, but let's use SQL lite SQL lite three payments, which is lightweight and simple. That is going to be a database, you need to create our source and our condition is going to the Alcorn Falcone shader in SQL lite three dots Connect now passing my data but DB right so that is the farther to go to store our database.

Then I need to create a cursor to be able to use to do my execution of my videos SQL functions to be called condition okay. So right through this is going to help us with creating our executions. Very interesting. So we have created a connection to a database. And then now we've created a case, paper. So let's see somewhere else, because we do so computers on here.

Some other static countries that we are going to be creating individual functions for TO CREATE TABLE party to add our data, and a function to be able to do in your PC that you want to do to view our data. So all these things that we have, we have a add in job showing, or even job searching within the SQL to help us do that, right. So let's see how to create a simple table for that. There's gonna be diff that create table. So this command that you're using rupees in in most of the CLS will put in press has to do it connecting to the database, right so escape same code can be repeated for all of them. This will lead to be critical, then I'm going to use C dot execute in our passing my SQL query to create table if not, if it is just right, if it would not exist, let's call it table job table, right jobs table.

Facility we are creating the list table is going to have some columns, the column space and it's going to be a column with a name, which is going to be test right then and this one is going to be our address. So we are using the same thing that we have here. This same thing is copy this in here. Same order. Then I'll just paste it here. Right now we're going to change is going to be test addresses are going to be test email address make an email by let's make it as test then do the rest right the same thing I've been doing so this is going to be how cool it is.

So this is going to be for test the next one drop is also going to be test that's all I can make it integer. Fruit anyhow you want it to be right so let's collect fruit. Correct integer anyhow you're allowed to be the next one is going to be hot. Let's make it integer in TJ and this is going to be for our test. So very simple. Very spotty, I tried to three or critical write code jobs today.

Because this one is set into that job table, this has global name or address or email or title, or test our job type, and then our salary in our status, very simple and very easy. That is the first step we are going to be creating that is going to create a table pivot. Now as I created a table function, we are going to move on and add our data to it. So this is a simple function to help us create a table. Now let's go back to adding our data is going to be our diff go to add data, then this is going to go with the same thing I pass so name, address, email title, job type, salary status, as usual, as the data added, so these are details being picked for this particular optional policy right. Very interested.

Then we are going to do is occasion and I'll go to a set data set. into our jobs table is about the jobs table for this particular party, so, we set into a Jeff table, the name address and the rest that is a simple stuff then what we need to do is that we will be passing in that question mark option right? To help us with this. So, is it to these particular values just replaces our values to be buddies, then our passing this so this is going to be I think 71234567 to be putting seven question mark to 777 is going to be another one, then three, three, I'll put in side up as well. Okay, that is all. There now we can just move on with coma in a passing day, seemed to navigate inside the bracket Right, very simple, very busy.

So, that is all that we have done so far. It's very similar that you have done. So what you are doing that you are setting into this particular job table, or these values that you are receiving from the user in their respective columns, right. And the basic idea behind this cluster is going to insert a row these values coming from here in the respective columns here, right. Perfect. That is the basic idea.

Now, certainly we have to be able to commit it, right. If you don't commit it, nothing is going to be saved. to even see that commit. Let's use corn corn was commit to commit into our database right perfect connection, which is referring to a database that is also going to create one to create a table. If I need to create a Wi Fi dish to add data Let's see how to work with a function to view right then you see what you have done so far to get out to view all the jobs is going to be understood as a view all jobs. So this is going to be by default, as you know, to be the Select right to select all to see that execute then go to be select all from Job's table.

Simple, right? Very interesting. So this is a simple function that you have created to help us get everything. Now we can actually collect that data that is coming. They use T rex fish, oh, Fitch gospel fish, fish, or a fictional history and everything inside our data can now we can retain our data. So this is going to help us get to our data view all jobs, very interesting.

Now let's create one last function which is going to be to help us to Select them to do select and everything, but if you want to select a particular stuff from a particular value, how do I do that right. So, let's create that function that is going to be help us to such something simple such old view by something single job by title or something like this where does that get single job by title right call this called Jessie single Good job by title. Can you see good job by title but how do we how does this thing goes Should I get in job by title so I'll be passing title here. Then we set up the server we can write this particular function, but unless you want to be seated execute, then immediately select going to be select select right on from Just table where that name is equal to hot item right?

Way that name to here can be named, but in this class, okay using title, right? I use me because a certain job by title just going to go with the way the column is titled The language passing a particular value data such as right as a basic ID, I just give a description. Then I just go format and are passing my title. Very interesting. So, we are just going to select all from job super quick title is called whatever the case may be type as title, right. That's the basic idea of what you are trying to do.

Then I'll close it here. And that is right. Something very simple something very busy. You can just stop it here this option. And then Chris It is very simple, right? That is what I read.

Cool, right? Now, let's go back to data tends to be my see that fish Oh, there is a vote called data and I cannot retain data it is going to help us to fetch job by title. So I can repeat the same thing for any other stuff I want to do is I want to search for by name. I just do the same thing copied by chain this one and this one and then this one. And then this one or two need to search by name, right perfect. So we get also to do for let's see, address the same thing.

Same code above. Then our chin this one too. Address respectively for the same simple code, which we address, right, very interesting. So I can use this same thing to run for the last one, which is going to be for our status, right? This used to want to work for our status log. That is something very cool, right you can use this option to this, this.

That is one way to do this. Another option is to try which you think is to want to search for status. So this is going to be for me, which we have quoted, if it's legal, it also want to search for address and also use the same thing here. And let's call this one a status, status status. And then one thing you should notice that says is an address is in perfect, so this is quite interesting too, is another way to do distance, right. So DNA for addresses Meet up ladies can also use the like, right through the code.

So let's try that example for this one. So it's going to be a statistic, we address. Like another way of doing it, and I pass in my value, which is going to be the question mark format. So it's going to look for anything that's like that particular stuff. But very interesting is going to be done flight is going to be this option. It took off this rainy day, question mark.

So we're going to look at anything that is like that. So basically, inside this particular option, then the same thing for this, right? Very interested in I'll bring to you today, Bruce Willis, bring the quotation mark here. And then at least it's just that you don't use this buffalo for my toilet or from Jeff's table. Name is that's how you can just use this option, right? Like this Like is going to Check for any simplicity of it, which is very, very powerful and very, very useful.

Whereas another way of using it very, very interesting. There's something basic. So let's see how to apply these things in our code. So I'm going to save this till here, come back to our jobs. Perfect, right. So that's something very busy can do.

So let's add it here too, to add it to this, make it simple by going with the CREATE TABLE function, it's going to be the first thing and this one's going to be our Add Data function, then I'll pass in the same value that you have here, right here is how to add it to our database. So we just passing the same thing we are creating a table is going to initialize this CREATE TABLE function here. Then add the data, respectively. Very, very interesting, right? Very simple, very cool, which is optional chapter. But let's show it to the user what a business type they just come back to this place and then beautified to something very simple right?

So can you see it tonight is the click to a cool let's give it some some ego for the pit whoever the person is type represent will know that he entered it and bunnies are going to be this Sunday they're very interested right so we will be changing this one too. I see added to database to database so I didn't know particular name of the company to the data base. The very simple right can also add a color to it in case you want to add color to it. Can I'll just pass in that particular foreground color can be empty. Blue. Very simple, right?

So something to show the user then let's work with adding the data issue anything Have a table. So we let our template table so let's see how to add a table to it be installing community which would you go to terminal is good pip install terminal tables, the template is going to enable us to be able to add tables to our CLR. Very interesting right so that is how to automate tables for database machinery. Now let's work on it. It's going to be from Terminal tables input yes about tables I turn it boots give you can have an ASCII table ASCII or sky table. That sort of easy.

If it can, this definitely will stick an array. So we can just call it as user nodes which we do want to get a list of a list. So this first list, then in this list is going to be a list policy the job before Then this is going to be our little right pivot table to create analysis for each and every one of these options. So I'm going to go with something like this for name or company name. Now passing debates globally for doing this like to do the same thing for all the rest. So you pick them for that.

So let me copy and paste because I can see save time. So the same thing you can use, or you can just call it a joke, no. joke, no. Anyhow, you want it to be there for joking For details, name, address, email title, job types. That is very interesting. So it's going to create a very simple case for us that the user can see.

Now, in case I want to show it to the user, I just come back to the same place. Can I just go to table one, in which case I'll use the ASCII table in our party, my job notes Good job notes. Simple, I tend to print out the table, just use click that echo table, one table where interest rates are that I need, then I can just show three that it has to click that circle. I'll pass it in this saved job to DB database, passing my foreground color of, let's make it very interesting. And then let's make the background color as yellow in the foreground fight can be any how you wish it to be. So let's see this one.

So, to recap, we have created a simple function to do a lot of things, right, normal functions to connect to a database, to create a table to create to add our data, to view all the jobs. These are all SQL stuff to get a single job To get job by title, job by name, your by address, JOB, JOB by status, then it is going to connect them to our CLA, we have added them under our job option. We are passing in everybody studies that option inside our Add table function, right? This would connect to a database and save a day than it is to shoot the user. I'm using terminal tables from template to support a table and I'm passing in some ASCII table. Then I'm printing later.

So let's see. We'll see what your data hopefully doesn't give us any errors because you have spent a lot of time on this is going to come back to the same thing. Run it again. So add to the name, SCOTUS, any company you want to be so Google then address is going to be a Silicon Valley, Silicon Valley. Then another one is a Google at alphabet s y z.com. Right, then this passing developer, the job title is going to be full time to keep us on Arrow.

So let's type it again. There is advantage of a trace, right? Let's go this route, the salary, then pendant because you have not even gotten it, because I just added everything they perfectly then just showed us the information that we added or the validity tied to go to Silicon Valley. We've got x developer mode, very interesting to all of these things. IBC to to view that we have a disclaimer to the Abuja option, or the show or option in your demos you want it to be, then you can just put it there, right? So let's try that one.

The simple way is I want to view or the job or shoe or the jokes or beating the shoe all auction day. 30 centimeters come back to this past year, then I'll do the same thing above, right. So let's see how it's going to be when you go to the same table to from demo tables. Input a sky table wants it to be easy for the peasant to see. So let me expand it here and have enough passion that you have to be results. The past in my view, the old jobs, right.

So this is the old jobs fashion is this particular fashion that we created here? Which is this the oldest fashion right? We are just going to look through everything and bring it up to the user. I'm just putting nothing in fashion here. It's a nice old option. Can I just get a new result is going to be the company name to address long distance right which is just positive intelligence.

Then I can actually print the entire stuff out. So let's just print the table out to take one to be asked by table, the party my results. Then I want to print out my click the table. Now passing my table one table. So let's see this one, come back to this simply that you have nine sort of run it, this particular option, we just go with our show. I wish it was going to print everything that was there.

Hopefully we find it. It's given us some errors because it was having this one as tables, table. Not table wanted one. This one is a good one, right? So the data that you entered there is being shown. So Google Silicon Valley, all of these tests are showing the right with all of these features, but it's better we give it a title at the top so that the user can use our copy that code MPC day, strategy seeds very Well, good to be here, right?

This employee that we had, right? So I just copied here you created today. So it is going to be something like this. The company name. So is this the same thing that we have here? company name, company address, email, job title, notice things.

I've created a list like this

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.