Project 03 - Jobtracker CLI - Editing and Deleting

Building Command Line Tools with Python, Julia and Nodejs Module 05 - Building CLI Tools - Projects
17 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.26
List Price:  €93.23
You save:  €27.97
£55.95
List Price:  £79.94
You save:  £23.98
CA$95.75
List Price:  CA$136.79
You save:  CA$41.04
A$107.23
List Price:  A$153.20
You save:  A$45.96
S$95.15
List Price:  S$135.94
You save:  S$40.78
HK$547.94
List Price:  HK$782.80
You save:  HK$234.86
CHF 63.91
List Price:  CHF 91.30
You save:  CHF 27.39
NOK kr766.40
List Price:  NOK kr1,094.90
You save:  NOK kr328.50
DKK kr486.75
List Price:  DKK kr695.39
You save:  DKK kr208.64
NZ$117.46
List Price:  NZ$167.81
You save:  NZ$50.35
د.إ257.06
List Price:  د.إ367.25
You save:  د.إ110.18
৳7,670.29
List Price:  ৳10,958.03
You save:  ৳3,287.74
₹5,832.01
List Price:  ₹8,331.80
You save:  ₹2,499.79
RM334.37
List Price:  RM477.70
You save:  RM143.32
₦88,678.72
List Price:  ₦126,689.32
You save:  ₦38,010.60
₨19,457.85
List Price:  ₨27,798.13
You save:  ₨8,340.27
฿2,591.43
List Price:  ฿3,702.20
You save:  ฿1,110.77
₺2,274.88
List Price:  ₺3,249.97
You save:  ₺975.09
B$360.25
List Price:  B$514.66
You save:  B$154.41
R1,330.75
List Price:  R1,901.16
You save:  R570.40
Лв127.68
List Price:  Лв182.41
You save:  Лв54.73
₩96,191.02
List Price:  ₩137,421.64
You save:  ₩41,230.61
₪265.67
List Price:  ₪379.55
You save:  ₪113.87
₱4,044.82
List Price:  ₱5,778.57
You save:  ₱1,733.74
¥10,886.62
List Price:  ¥15,552.99
You save:  ¥4,666.36
MX$1,193.70
List Price:  MX$1,705.36
You save:  MX$511.66
QR254.90
List Price:  QR364.16
You save:  QR109.26
P969.33
List Price:  P1,384.82
You save:  P415.49
KSh9,413.65
List Price:  KSh13,448.65
You save:  KSh4,035
E£3,352.26
List Price:  E£4,789.16
You save:  E£1,436.89
ብር3,973.96
List Price:  ብር5,677.33
You save:  ብር1,703.36
Kz58,616.62
List Price:  Kz83,741.62
You save:  Kz25,125
CLP$66,678.07
List Price:  CLP$95,258.47
You save:  CLP$28,580.40
CN¥507.14
List Price:  CN¥724.52
You save:  CN¥217.38
RD$4,110.44
List Price:  RD$5,872.31
You save:  RD$1,761.87
DA9,401.90
List Price:  DA13,431.87
You save:  DA4,029.96
FJ$160.42
List Price:  FJ$229.18
You save:  FJ$68.76
Q543.26
List Price:  Q776.12
You save:  Q232.86
GY$14,630.45
List Price:  GY$20,901.55
You save:  GY$6,271.09
ISK kr9,795.80
List Price:  ISK kr13,994.60
You save:  ISK kr4,198.80
DH709.23
List Price:  DH1,013.23
You save:  DH303.99
L1,246.59
List Price:  L1,780.93
You save:  L534.33
ден4,020.35
List Price:  ден5,743.61
You save:  ден1,723.25
MOP$563.94
List Price:  MOP$805.67
You save:  MOP$241.72
N$1,340.22
List Price:  N$1,914.68
You save:  N$574.46
C$2,572.43
List Price:  C$3,675.06
You save:  C$1,102.63
रु9,316.74
List Price:  रु13,310.19
You save:  रु3,993.45
S/259.29
List Price:  S/370.43
You save:  S/111.14
K265.67
List Price:  K379.55
You save:  K113.87
SAR262.50
List Price:  SAR375.02
You save:  SAR112.51
ZK1,825.88
List Price:  ZK2,608.51
You save:  ZK782.63
L324.76
List Price:  L463.96
You save:  L139.20
Kč1,644.30
List Price:  Kč2,349.11
You save:  Kč704.80
Ft25,615.12
List Price:  Ft36,594.60
You save:  Ft10,979.47
SEK kr760.35
List Price:  SEK kr1,086.27
You save:  SEK kr325.91
ARS$61,118.20
List Price:  ARS$87,315.45
You save:  ARS$26,197.25
Bs482.97
List Price:  Bs689.99
You save:  Bs207.01
COP$272,384.35
List Price:  COP$389,137.18
You save:  COP$116,752.82
₡35,055.79
List Price:  ₡50,081.85
You save:  ₡15,026.05
L1,725.31
List Price:  L2,464.83
You save:  L739.52
₲519,197.15
List Price:  ₲741,742.01
You save:  ₲222,544.85
$U2,684.12
List Price:  $U3,834.62
You save:  $U1,150.50
zł281.58
List Price:  zł402.27
You save:  zł120.69
Already have an account? Log In

Transcript

All right, so welcome back. So in the previous session, we saw how to add some such feature to our CI, and how to show the data in Osceola. Now let's see how to edit our data, right how to add editing of our jobs inside our database. So let's enter our CL so let's see how to a credit. I'm just going to go to the top of my phone and write some functions to help us with that. So I'm going to just create a simple function is going to be an edit function define our function with edit job by a particular stuff to be greeted by me.

Right so the first thing is going to be our board name, then our new name that you're editing by. Right, perfect that's updating to the new building. Is acute within the normal SQL update to help us with that show to be updated. Did table Our job stable and what are we updating which we are updating and then we are setting the old name. Setting the title for this is named to certain the name from the automatic infamous, we're setting the name to this option. Let's make it like this option right?

If it were you so first of all in updating or editing you have to first of all search for it right? Then after searching for it, then you can actually edit it right we are editing, we are searching for it and also editing or updating that particular piece written name by that particular option that is going to go with the normal format. So it's format. So what are you passing you are going to pass in our old name in our new need to help us with that. So we are actually searching for the good name here. Right there, yeah, I've written it or setting it to the new name.

So this is going to go with our union fist. Because that's what you have sitting here, right? Now, okay? That's a basic idea, then after that you have to commit the code to its commit to actually commit data stuff, that now we can be able to get the data back again, right? To go to the data. See that fetch Oh, there, we cannot retain that data to retain it.

So that's the big idea of how to edit objects are using this particular option to edit job by name, then you are passing the code name a new name, then you are updating a table by first of all searching for that old name, here with this particular option, then after certain certain for it, we will update it to set it to a new meet to congest capitalism function for our title He's wanting to get a job by title to edit job by status. So let's go on with this offer title. Just change these ones to title right that's the basic idea the same code, but just changing the name. So just want to be title to edit your by title do the same thing for your status can add the address to it if you want to do this this and this and then finally you have this is just going to be by status, the status or status anyhow you call it right.

So that isn't the basic purpose we have need to write down three functions. So one to edit by name, want to edit by title want to edit by status, right so in case you want to do that you just run or nothing option So let's come back to our CLA command, which is the Edit job and then write some code here. So what we tried to do just for writing some code and and how we are going to be editing it that should be edited by Cloverfield, right. So it's going to be like this be edited by field. And the particular way that you want to change by policy default is going to be developer field. Right?

This applies because it is a full like that offered like title. Then another option not to be green is the old to be the old ninja gesture for which can be developer, then the new one that you get into who's going to be the data scientists. Something very basic, it's very simple. So that is what you are trying to do, right? So you have to create a function an option for the field, an option for the old option for the new. So let's click on it.

So I just come back here and then right my first one is going to be selected option for the field. So it can be Wrong format and then it should format right is going to be fulfilled and create another one for the option for our old name and our last name could be old. School can also add help so it is going to be hard to like help hold name owed data to edit right there at the same day for the next one which is going to be for new. So this is going to be filled hootenanny knew it's good to be in then new data to update right. new data to this very interesting right now is passing our build our code and then our pivots Something very cool, you can actually bring this particular code above here. So let's say for example, something easy for the user to use, as one of our best practices.

Couldn't be Python three, and I'll pass it here, right, something very interesting. Let's see this one, this come back down. And now from here, I can actually start writing some code is going to be click that circle. Then I specified a photo editing, editing field. And I pass in a class with a percentage editor, so at least you know what's for the editing with old data, right then, and updated with the new data, right, so we have a full database and editing by the third name. And then the data day for the old one, the current or the updated data center like this thing is good format.

Can I pass in festival which party might Then I pass in Dennis, good to be the old name, then a new name or a new data, right? So I got to add some foreground color to it, which is going to be white. And then the background is going to be cyan, or can be any color. Let's make it look different. We have to right center very simple. And let's see how to work with a fascist.

So we'll be using the same factories above to help us but it is more useful in case we actually show the user what is going to be edited the previous data before, edited and deleted we show they have deleted so let's make if I click Echo, in PC tendonitis, some beautification stuff to it. So this will be just simple like that right now I can mute get everything from that's it. This was result Which is going to be my view all jobs previewed every tester with integer result, then I can just use the same code we have above here for viewing our data, which will this same code here, copy the same code to actually show the user what is there before these are updated, right? Perfect, then the next question is going to be what you be trying to update. So I just move on to the next option, I can specify the field that I want it by, as well as the rest.

Perfect, so not gonna screw it no more if condition is going to be if my field is equal to title, right. Then I wanted to use that title. Let's call that result. This can be resolved one or two. Let's make it as results. Right now, just so everything is that a particular result.

If I felt it's good to title, then I want to use the Edit job by title function in order to pass in your personal data. coordinate ended and unique, right. So in any case, if I just did it, then would you print it out again to be using the same command above here, because we are trying to bring all the same stuff. Let's come back to this option. Recently this right, we are bringing the result. Perfect.

So I'll just repeat this one, let's make this one result. At least read or to write or at least it's very different from the other one. And I'll just come back let's make this table to table two notes to be table one. So going to it I just copy this one and repeat for the rest. So, for the next one, for this one, so this is going to be if the field is name, right the company name then I want you to use edit by job and the job binding. entity same thing.

Then if the field is status, do the same thing right The basic idea you're editing this particular option here, by the stitches to the same punches above is what you're trying to use. Let's make this an elsif. Pivot something very simple, something really busy, can also add an else condition to it. But let's leave that one. So I thought writing something like that after we have to shoot either what has been updated, so in do so I can just repeat the same stuff here. So this is going to be the new data right to you, first of all, preview the data.

It is the data, then we tell the user that this is the new data, right? So this is going to be updated, updated. The right so the same stuff we are doing. Now let's come back to this. Let's take a circle back to my terminal which is here to find this shoe or that hope doesn't With any videos on Arrow somewhere with this white background stuff, which is on line 193. So let's edit it at line one, three, which is here 123, then we have to make it as foreground background, which is going to be BG, right?

BG, once again, doesn't give us any error if it everything is working, because I want to edit data scientists to AI engineer right, so I can just do the same thing. So lucky it's going to be my edit, job. agree that says hope, beauty see how it works, right? So the same thing would be at a job apart in the field. Before that I'm editing is the field called title. So small title, then what I'm trying to edit is going to be a hood name.

Let's make it with the equal to editing data scientists. Then the new name good Be a start up and put it on putting AI engine, you know what I received in a very different, right? If I save it now, which add it to a supervisor given us editing field title with data scientists can update into AI engineer, then disappear data is what data scientists and under the updated data is AI engineer. Right? Very, very interesting. So we have seen how to actually edit our data.

Very, very cool. So now let's move on to the next option of how to delete our data. So which is going to be coming back to the same place, so I'll come back to it took my fault here, write a simple function to delete it with the diff and delete data. Right so let's see how how is going to be to be deleted by title by to passing title here. Can you see that execute, see that execute. Then what I'm going to pass there's going to be a normal SQL function is meant to be deleted.

From my table, my jobs table Particular stuff, right? So for my joke table where the title is equal to what is being supplied, tend to be this option. I'll pass it here, this good format, I see my title, then I have to commit it to that at least it's become executed to con its commit, then I can actually retain it or I can just lose it, right number 10. Anything. Let's see the final so it is going to be used to delete our data. So delete from our table, where the title is upper class data apply for come back to my delete option command here and work on it.

So let's see how to work on it. We've got to be very simple. So we are using title to delete it. So it's going to be a simple code like this. As you bring an option of title to be click that Option, not passing by title, title, long format, short format. That is something simple.

Now passing that option inside my function, then I'll just tell the user that I'm going to delete this particular topic to be click. Let's copy the slides above. At least it's good to see help us save time. Unless you just search one. Yeah, becoming easy, right? Anyway, this, this is going to be deleting then passing the test that you're trying to get is meant to be a title.

Right? Perfect. So this is a very simple now, IBM to work on a service. First of all, I think it's better you also preview to the user, what he's going to delete before the user deleted. So I'll just use the same code we did above for the previous Here, so the user knew that he is deleting something. Let's make this one, right.

So instead of it being signed, which make us read in that is dangerous. Then later on, I'm going to actually work on the function to deleted so I'll just come back to the same place and go to my result is going to be resolved to is going to be our delete, delete data. And I'll pass in my data, right, so I'm going to pass in a title. Then I'm going to click to echo and I thought data which has been deleted, so turn that deleted. Let's make it big or delete. deleted from dB.

Right from database. Something very busy, I can even make it seem tallada Have you? So let's make it like that. You bring it here. Use sickle for that. So let's see what else right again, I'll come back to this.

Let's check for the show Oh, we have our data a case I want to delete one from it. So I can just use the help to help us with that. It can delete our job. So if I want to delete a job, we just come up to delete, job, just help. So we are supplying the title. So whenever we delete the job by the title, and the title you're trying to delete by is that from our data, we had AI engineer get on to delete the engineer from it can just come back to the same place.

He continued on it fizzle. It's good to show the data, right? If it then is going to delete it. So if I come back, can I run it again around the show all option. Now here engineer today is how to add division option to Osceola. For a nutshell, we have seen how to build a simple job tracking ci that is using adios crude option create, read update delete, to help us track and keep records of all our job.

So we have seen how to click on the database while using SQL lite database have created individual functions to help us directly database to edit to delete, then you created our simple COI commands. And then we used orders you have learned previously to be able to put up something very basic something very simple. So thank you for watching this in the next session of how to add some beautification to Osceola. Thank you and stay blessed.

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.