Kafka Eagle
Search…
9.KafkaSQL
Use the SQL statement to the news data visualization in topic, for SQL queries, and table names field need to use double quotes to mark, example SQL is as follows:
1
select * from "ke_test_topic" where "partition" in (0,1,2) limit 100
Copied!
As shown in the following figure:

Edit SQL

DataSets

1
Note: Access to topic message data, depending on the underlying interface record of the earliest and latest offset, the default display up to 5000 records.
Copied!

Parse JSONObject Or JSONArrays

Kafka topic datasets like this:
1
[{"id":123,"name":"smartloli"},{"id":456,"name":"smartloli2"},{"id":789,"name":"smartloli3"}]
Copied!
Then you can use sql query topic like this:
1
select JSONS("msg",'name') from "topic_name" where "partition" in (0) limit 10
Copied!
When Kafka topic datasets like this:
1
{"id":123,"name":"smartloli001"}
2
{"id":456,"name":"smartloli002"}
Copied!
Then you can use sql query topic like this:
1
select JSON("msg",'name') from "topic_name" where "partition" in (0) limit 10
Copied!
Add and:
1
select JSON("msg",'name') from "topic_name" where "partition" in (0) and JSON("msg",'name') = 'smartloli001' limit 10
Copied!

Filter Query [where ... and]

Kafka topic datasets like this:
1
kafka-eagle-01
2
kafka-eagle-02
3
kafka-eagle-02
4
kafka-eagle-03
5
kafka-eagle-03
6
...
7
kafka-eagle-03
8
kafka-eagle-04
Copied!
Then you can use sql query topic like this:
1
select * from "topic_name" where "partition" in (0) and "msg" = 'kafka-eagle-03' limit 10
Copied!
Add like:
1
select * from "topic_name" where "partition" in (0) and "msg" like 'kafka-eagle%' limit 10
Copied!
Or:
1
select * from "topic_name" where "partition" in (0) and "msg" like '%kafka-eagle%' limit 10
Copied!
Last modified 1yr ago