14 videos 📅 2024-05-06 08:00:00 America/Creston
39:11
2024-05-06 08:57:50
3:11:28
2024-05-06 10:30:19
24:39
2024-05-07 07:20:20
19:49
2024-05-07 08:03:25
1:14:35
2024-05-07 08:35:13
15:41
2024-05-07 10:06:25
38:33
2024-05-07 10:37:03
2:48
2024-05-07 11:19:01
59:37
2024-05-07 11:33:56
6:10
2024-05-07 14:55:25
39:40
2024-05-07 15:02:44
9:45
2024-05-08 06:44:21
29:27
2024-05-08 08:09:24
2:51:40
2024-05-08 12:09:24

Visit the Apache Nifi - GROUP 1 course recordings page

                WEBVTT

00:00:02.380 --> 00:00:04.140
Pedro, how are you looking?

00:00:05.180 --> 00:00:08.140
All right, I guess.

00:00:08.720 --> 00:00:14.460
I was able to get the JSON into a...

00:00:14.460 --> 00:00:17.320
I compiled the CSVs into the new JSON format.

00:00:17.480 --> 00:00:18.460
Oh, awesome.

00:00:20.520 --> 00:00:23.900
Now I was just kind of like

00:00:23.900 --> 00:00:26.840
putting some kind of data in there, but I just kind of got stuck.

00:00:29.500 --> 00:00:31.020
Take that data and

00:00:31.020 --> 00:00:35.220
send it to an evaluate JSON processor, and then you can

00:00:35.220 --> 00:00:37.880
extract all of those values if you need.

00:00:39.120 --> 00:00:41.920
And you can then manipulate them.

00:00:43.500 --> 00:00:46.560
The evaluate JSON processor, you want to do

00:00:46.560 --> 00:00:49.960
content as an attribute, and it will save it all as an attribute.

00:00:50.100 --> 00:00:53.860
And then you can actually then go through and, as an attribute,

00:00:54.680 --> 00:00:57.580
modify the data, combine the data,

00:00:58.300 --> 00:00:59.940
do averages, whatever.

00:01:01.960 --> 00:01:04.520
Yeah, I was kind of moving in to see what I can get.

00:01:05.540 --> 00:01:09.320
I was trying to extract the text and then put it into an attribute.

00:01:09.620 --> 00:01:13.860
And then I guess it can be updated. So I was trying to see if I could just put in the

00:01:15.020 --> 00:01:15.900
kind there.

00:01:16.800 --> 00:01:21.660
Look at the evaluate JSON. Evaluate JSON I think will be very helpful.

00:01:21.660 --> 00:01:25.720
Across the board for everyone. Just because it's pretty easy

00:01:25.720 --> 00:01:30.140
once you have where you're at, you can do an evaluate JSON

00:01:30.140 --> 00:01:33.760
and it will pull all

00:01:33.760 --> 00:01:37.540
of that data up as an attribute and you're good to go.

00:01:38.200 --> 00:01:41.780
So if I was designing this flow route and I was trying to do it extremely

00:01:41.780 --> 00:01:45.580
quickly, I would have a git file

00:01:45.580 --> 00:01:49.580
grabbing the two CSVs. I would kind of reuse

00:01:49.580 --> 00:01:52.680
the previous step where I converted that to JSON,

00:01:53.580 --> 00:01:57.680
but then take all three of those JSONs, send it to an evaluate JSON

00:01:57.680 --> 00:02:01.860
processor, extract the values, and then

00:02:01.860 --> 00:02:06.040
once I have them all as an attribute, it's easy to

00:02:06.040 --> 00:02:09.580
manipulate. But I think you're on the

00:02:10.100 --> 00:02:13.200
right path. So yeah, if you see that evaluate JSON path,

00:02:13.560 --> 00:02:17.400
and you send a JSON, a little tip on this one,

00:02:17.400 --> 00:02:21.200
go to the properties and evaluate JSON path, and the destination,

00:02:21.340 --> 00:02:25.040
you want it to be flow file attribute, not content.

00:02:26.760 --> 00:02:29.220
And then say OK.

00:02:29.980 --> 00:02:33.020
And then you can just hit plus and start

00:02:33.020 --> 00:02:37.860
adding in the path

00:02:37.860 --> 00:02:40.380
to extract the data.

00:02:42.900 --> 00:02:45.160
So for instance,

00:02:45.160 --> 00:02:49.160
let me see if I can...

00:02:50.360 --> 00:02:53.780
So if you, for instance, you

00:02:53.780 --> 00:02:57.360
can use, depending on the

00:02:57.360 --> 00:02:59.720
JSON, right, you can...

00:02:59.720 --> 00:03:04.080
OK. So

00:03:04.840 --> 00:03:08.280
can you open up one of your JSON documents right quick?

00:03:08.580 --> 00:03:10.580
Awesome, awesome, awesome.

00:03:13.260 --> 00:03:15.040
So, so,

00:03:15.040 --> 00:03:18.840
for station ID, I would name this one like station ID.

00:03:18.840 --> 00:03:22.980
So go back to your, configure your processor.

00:03:24.140 --> 00:03:25.420
You can do station ID.

00:03:26.920 --> 00:03:29.960
I would do all lowercase and then say OK.

00:03:30.380 --> 00:03:34.980
And then what you're looking for here is the

00:03:36.200 --> 00:03:38.720
path in the JSON. So you want to put

00:03:38.720 --> 00:03:42.100
$. and then look at your JSON

00:03:42.720 --> 00:03:43.560
station ID.

00:03:44.920 --> 00:03:48.840
Just copy that

00:03:50.860 --> 00:03:55.020
and paste it in. And so what it's doing

00:03:55.020 --> 00:03:58.760
is, and you may have to reformat your JSON

00:03:58.760 --> 00:04:02.740
for the rest of this, but what it's going to do, what this would do

00:04:02.740 --> 00:04:06.780
is it would extract station ID and

00:04:06.780 --> 00:04:10.780
create a key pair value as an

00:04:10.780 --> 00:04:14.900
attribute. So if you say OK here and you say apply, when

00:04:14.900 --> 00:04:17.860
that JSON goes through that processor,

00:04:18.800 --> 00:04:22.860
it's going to extract the data from station ID

00:04:22.860 --> 00:04:26.960
and then save that as an attribute. And so what you're

00:04:26.960 --> 00:04:30.180
able to do is

00:04:30.780 --> 00:04:34.780
keep adding these property and values and

00:04:34.780 --> 00:04:38.460
you would be able to extract all of those attributes as key pairs.

00:04:39.940 --> 00:04:42.240
And then you can

00:04:42.780 --> 00:04:46.960
manipulate those, do whatever you need, because they would

00:04:46.960 --> 00:04:51.000
now be an attribute. And then use the attributes to JSON

00:04:51.000 --> 00:04:53.660
to save the file

00:04:54.780 --> 00:04:58.960
as a JSON document with the temperature

00:04:58.960 --> 00:05:01.960
alert or whatever that's in this scenario.

00:05:03.020 --> 00:05:03.580
So,

00:05:05.360 --> 00:05:07.640
yeah, and you just leave the past.

00:05:09.100 --> 00:05:13.560
So basically grab all of the values from my JSON file

00:05:13.560 --> 00:05:16.860
and then store them as something. These are like variables kind of?

00:05:17.020 --> 00:05:20.820
Correct. Store them as an attribute. Yep.

00:05:21.080 --> 00:05:24.760
And then we'll kind of compile all of those into one

00:05:25.840 --> 00:05:28.520
and then you can do whatever you want with that.

00:05:28.520 --> 00:05:30.420
Exactly, exactly.

00:05:32.040 --> 00:05:36.380
So the key here, you're looking at the evaluate

00:05:36.380 --> 00:05:39.780
JSON path, those types of processors,

00:05:40.700 --> 00:05:44.960
you're looking at attributes to JSON to write the final

00:05:44.960 --> 00:05:48.680
JSON document, but you're getting very, very

00:05:48.680 --> 00:05:52.800
close. Awesome, yeah. I mean, I would have to definitely play with it

00:05:52.800 --> 00:05:56.260
a little bit more, but I think I see where you're getting at. OK. Yeah,

00:05:57.040 --> 00:05:59.840
we're a couple minutes over, but just play with it

00:06:01.080 --> 00:06:04.480
and let me know how it goes. But those are definitely

00:06:04.480 --> 00:06:07.080
some of the things that you might want to take a look at.

00:06:07.680 --> 00:06:09.620
And then we'll talk about it in the morning.