DEV Community

loading...

[FLaNK] Smart Weather Applications with Flink SQL

tspannhw profile image Timothy Spann Originally published at datainmotion.dev on ・4 min read

[FLaNK] Smart Weather Applications with Flink SQL

Sometimes you want to acquire, route, transform, live query and analyze all the weather data in the United States while those reports happen. With FLaNK, it's a trivial process to do.

From Kafka to Kudu for Any Schema of Any Type of Data, No Code, Two Steps

*The Schema Registry has full Swagger-ized Runnable REST API Documentation. Integrate, DevOps and Migration in a simple script. *

Here's your schemas, upload, edit and compare.

Validating Data Against a Schema With Your Approved Level of Tolerance. You want extra fields allowed, you got it.

nifi

Feed that data to beautiful visual applications running in Cloudera Machine Learning.


You like drill down maps, you got them.

Query your data fast with Apache Hue against Apache Kudu tables through Apache Impala.

Let's ingest all the US weather stations even though they are a zipped directory of a ton of XML files.

Weather Ingest is Easy Automagically

View All Your Topic Data Enabled by Schema Registry Even in Avro Format

Reference:

https://www.datainmotion.dev/2020/07/ingesting-all-weather-data-with-apache.html

Source:

Build

https://github.com/tspannhw/ApacheConAtHome2020/blob/main/scripts/setup.sh

Query

https://github.com/tspannhw/ApacheConAtHome2020/blob/main/scripts/flink.sh

SQL

| INSERT INTO weathernj |
| | SELECT location, station_id,latitude,longitude,observation_time,weather, |
| | temperature_string, temp_f,temp_c,relative_humidity,wind_string,wind_dir,wind_degrees,wind_mph, |
| | wind_kt, pressure_in,dewpoint_string,dewpoint_f,dewpoint_c |
| | FROM weather |
| | WHERE |
| | location is not null and location <> 'null' and trim(location) <> '' and location like '%NJ'; |

Kafka Insert

https://github.com/tspannhw/ApacheConAtHome2020/blob/main/flinksql/weathernj.sql

Schemas

https://github.com/tspannhw/ApacheConAtHome2020/blob/main/schemas/weathernj.avsc

https://github.com/tspannhw/ApacheConAtHome2020/blob/main/schemas/weather.avsc

Example Slack Output

12:56

=========================================================

http://forecast.weather.gov/images/wtf/small/ovc.pngLocation Cincinnati/Northern Kentucky International Airport, KY Station KCVG

Temperature: 49.0 F (9.4 C)

Humdity: 83

Wind East at 3.5 MPH (3 KT)

Overcast

Dewpoint 44.1 F (6.7 C)Observed at Tue, 27 Oct 2020 11:52:00 -0400---- tracking info ---- UUID: 2cb6bd67-148c-497d-badf-dfffb4906b89

Kafka offset: 0

Kafka Timestamp: 1603818351260

Discussion (0)

Forem Open with the Forem app