Latest version: 4.3.x
Navigate & Query Topic Data
When navigating to a Kafka topic, you can query all existing data and the live stream. Lenses immediately presents a snapshot of the latest data in table browsing mode allowing:
- To Filter by timestamp, offset or partition.
- To Drill into the data and expand the key and value payloads and any nested fields.
- To Work with any data type to Query, Insert, Delete.
Navigate to data
- From the Header Bar Menu, go to the Dashboard panel
- On the side navigation, select Explore under Data section.
- Make sure that your Kafka connection is selected on the connection filter
- Select the topic you are interested in
- Select the Data tab
Query data
Data record inspection can be done via the quick filter or SQL editor. The result set is available in 2 different formats: Tree and Grid view. You can switch views from the right-hand icons.
Quick filtering
The quick filter provides an interactive way to filter data. Available filters include partitions, start offset or timestamp and limiting records returned.
SQL filtering
Switch to the SQL editor to run queries by selecting SQL.
Query a live stream
Switch to live continuous query mode by selecting Live Sample.
Insert data
- From the Explore Menu, select a particular topic.
- Click on the Actions menu on the top right of your screen
- Select Insert Messages.
If you select to auto generate, Lenses will use the known schema of the key and the value, and synthetically generate an insert statement for you.
Insert using SQL
If you want to automate or make repeatable the insertion of new messages
in Kafka topics, use the INSERT INTO
SQL statement. Example:
INSERT INTO customer (_key, id, address.line, address.city, address.postcode, email)
VALUES ('david.green', 'david.green', '4309 S Morgan St', 'Chicago', 60609, 'david.green@lenses.io');
Delete data
Deleting data from topics is supported by removing all messages from a partition up to a specific offset. The deletion of messages on compacted topics is also supported.
To delete data records from a topic:
- From the Explore Menu, select a particular topic.
- Click on the Actions menu on the top right of your screen
- Select Delete Messages.
Select messages to remove
Currently, you can select a particular partition and drop all messages from its beginning to a specific offset.
Delete using SQL
Use DELETE
SQL statement to remove records from the topic.
Example:
DELETE FROM customer WHERE _meta.offset <=10