Hey, we'll come back in this video.
I'll show you my solution to the two tasks I gave you in the previous video.
So the first task was to implement a skill light as well in this app.
So this app extracts temperature from this side.
Now what I did to implement a skill is first I imported skill three In here I establish a connection
somewhere in here.
And then I refer to that connection variable in here.
So that's my store function.
Once I get the data stored in a string, so the current date and time, including the how is the meaning
of the seconds.
Then I create a cursor object using this method, and then this is my SQL query.
So I insert into temperatures.
So temperatures is.
My database table, which looks like this date and temperature.
So we have these two values.
Temperature is a real number.
So when I created a new table, I set the temperature column to be a real type and date to be a text
type.
And that's the query.
To insert.
The no string, the date and the temperature.
So the temperature value, which could be 18, 19, etc. would be stored in this variable extracted.
And then I get extracted and I place it here.
So that will be a real number, a float.
You could also use integers, but since temperatures are continuous data, it's better to use a float.
And here I commit the changes so that the changes are written to the database.
So that was the first task.
The second task had to do with the app.
So that's my code for the stream app.
So I import.
I still like three.
I establish a connection in here.
I create a cursor object, and then this is my SQL query.
So I select from date.
So so I'm selecting the date column, the entire values of date column from temperatures.
And then I told the results in this date variable.
So at this point, date will be something like a list of tuples like this.
And inside each tuple you'll have the data string sort of two eight, eight, 22, 11 or something like
that.
And then the next date.
And so what?
So you can see that the dates, the strings are nested inside tuples.
That's why I have I have this other line here.
So basically I go through each of those tuples and then I struck the first item of each tuple using
this item zero.
So therefore, this new list will contain only the strings.
So the first string of the first tuple, then the next string of the next tuple and so on.
So in here, this list will be a clean list of strings.
Right.
Let me remove that.
And then I do the same exact thing for temperature.
So I get the cursor and I execute this method.
So that's the same code as this.
The only difference is that we're getting the temperature column here from the temperatures table.
So the table is the same, but two different columns.
Then finally, I provide the date list to the x variable and the temperature lists to the Y variable.
And that's the labels of graph.
Then I render the figure and that's the result.
So thanks for listening to this video or for watching it or both.
I know some exercises are quite hard.
You get stuck at certain points, but then when I show you the solution, then it triggers something
in your mind.
So you really, really learn better.
I would say when you do some errors and then you see what what mistakes you did.
So that really implants into your mind that the concepts better.
So don't worry if you if you do mistakes and if you don't solve some parts of these projects.
So thanks a lot for following and I'll see you in the next video.