Kafka Gets KSQL JDBC Driver
Written by Kay Ewbank   
Thursday, 16 November 2017

There's a new JDBC driver that provides standard access to Apache Kafka via JDBC API.  The current version connects to the KSQL engine to perform queries to Kafka and then, the engine translates those requests to Kafka requests. 

The sql-jdbc-driver is a Type 3 Java Database Connectivity (JDBC) driver. KSQL is an open source, Apache 2.0 licensed streaming SQL engine that enables stream processing against Apache Kafka.

KSQL is still a developer preview, and it has been designed to make it easier to read, write, and process streaming data in real-time, at scale, using SQL-like semantics. The developers say using SQL is an easy way to express stream processing transformations as an alternative to writing an application in a programming language such as Java or Python.

KSQL supports stream processing operations including aggregations, joins, windowing, and session management. KSQL doesn't let you do lookips on data; instead, it is used for continuous transformations. The example given by the developers is that of a stream of clicks from users along with a table of account information about those users being continuously updated. KSQL lets you model this stream of clicks, and table of users, and join the two together, even though the stream of clicks isn't a specific size.

The queries created using KSQL are described as continuous queries, transformations that run continuously as new data passes through them, on streams of data in Kafka topics.

The language does look SQL-like:

CREATE TABLE error_counts AS
SELECT error_code, count(*)FROM monitoring_stream
WINDOW TUMBLING (SIZE 1 MINUTE)
WHERE type = 'ERROR'

The developers suggest it could be used in applications where you need to transform an input stream into an output stream, but the application is simple enough to make the SQL interface enough without the need to use Kafka’s native streams API. KSQL uses Kafka’s Streams API internally and they share the same core abstractions for stream processing on Kafka.

Streams can be created from a Kafka topic or derived from existing streams and tables.

CREATE STREAM pageviews 
(viewtime BIGINT, userid VARCHAR, pageid VARCHAR) WITH (kafka_topic='pageviews', value_format=’JSON’);

While the current version of the JDBC driver just connects to the KSQL engine, and lets you run KSQL queries, the developers plan to add a standalone mode that will connect directly to Kafka brokers.


 ksql

 

 

More Information

KSQL JDBC Driver On GitHub

KSQL Website

Related Articles

Kafka 1 Becomes More Tolerant

Comparing Kafka To RabbitMQ

Apache Kafka Adds New Streams API

GoKa Stream Processing For Kafka

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


The University of Tübingen's Self-Driving Cars Course
22/03/2024

The recorded lectures and the written material of a course on Self-Driving Cars at the University of Tübingen have been made available for free. It's a first class opportunity to learn the in an [ ... ]



We Built A Software Engineer
20/03/2024

One of the most worrying things about being a programmer today is the threat from AI. It has gone so far that NVIDA CEO Jensen Huang proclaims that you really shouldn't start training as a programmer  [ ... ]


More News

 

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Thursday, 16 November 2017 )