Some of the content described in this article is available in meshIQ Manage versions 12.0 and later.
For a quick overview of what's new or changed, visit the meshIQ Highlights page for a version-by-version breakdown.
Jump to Section:
Version 11.2 and Earlier
Version 12.x and Later
Version 11.2 and Earlier
The Execute KSQL Command action is available from KSQL object viewlets. KSQL objects can be set up when on the KSQL tab when you create a Remote Kafka Manager Connection.
The example below shows KSQL commands being used to create a table and a stream. To learn how to view the table and stream records, see Read Queries, Tables, and Streams.
Execute a KSQL Command
To execute a KSQL command:
- On a KSQL viewlet, click Execute KSQL Command on a KSQL object's action menu (Selected menu in 11.2). The Kafka KSQL Commands dialog opens.
- Enter the SQL Command in the SQL field.
- Click OK. The result of the command is displayed in the Response field.
Create Table Command
CREATE TABLE TABLE1 (
id BIGINT PRIMARY KEY,
usertimestamp BIGINT,
region_id VARCHAR
) WITH (
KAFKA_TOPIC = 'ksql_topic2',
VALUE_FORMAT = 'JSON'
);
Create Stream Command
CREATE STREAM KSQL2 (
ksqlq_id BIGINT,
time BIGINT,
user_id VARCHAR
) WITH (
KAFKA_TOPIC = 'ksql_topic2',
VALUE_FORMAT = 'JSON'
);
________________________________________________________________________________________________________________
Version 12.x and Later
The Execute KSQL Command action is available from KSQL object viewlets. KSQL objects can be set up when on the KSQL tab when you create a Remote Kafka Manager Connection.
The example below shows KSQL commands being used to create a table and a stream. To learn how to view the table and stream records, see Read Queries, Tables, and Streams.
Execute a KSQL Command
To execute a KSQL command:
- On a KSQL viewlet, click Execute KSQL Command on a KSQL object's Selected menu. The Kafka KSQL Commands dialog opens.
- Enter the SQL Command in the SQL field.
- Click Ok. The result of the command is displayed in the Response field.
Create Table Command
CREATE TABLE demo2_stream_count AS
SELECT user_id, COUNT(*) AS stream_count
FROM demo_stream_2
GROUP BY user_id
EMIT CHANGES;
Create Stream Command
CREATE STREAM demo_stream_2 (
user_id INT,
user_name VARCHAR,
country VARCHAR,
date VARCHAR,
time VARCHAR,
timestamp BIGINT
) WITH (
KAFKA_TOPIC = 'demo.topic.2',
VALUE_FORMAT = 'JSON'
);